Compare commits

...

1 Commits
1.18.0 ... ai

Author SHA1 Message Date
Stef Heyenrath
7ad8b60fbd ai 2019-02-18 22:36:01 +01:00
6 changed files with 39 additions and 25 deletions

View File

@@ -0,0 +1,7 @@
{
"ProviderId": "Microsoft.ApplicationInsights.ConnectedService.ConnectedServiceProvider",
"Version": "8.14.20131.1",
"GettingStartedDocument": {
"Uri": "https://go.microsoft.com/fwlink/?LinkID=798432"
}
}

View File

@@ -1,7 +1,7 @@
using System;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using System;
using WireMock.Settings;
namespace WireMock.Net.WebApplication
@@ -21,7 +21,7 @@ namespace WireMock.Net.WebApplication
serviceProvider.GetService<App>().Run();
}
private static void ConfigureServices(IServiceCollection serviceCollection)
private static void ConfigureServices(IServiceCollection services)
{
// Build configuration
var configuration = new ConfigurationBuilder()
@@ -30,28 +30,30 @@ namespace WireMock.Net.WebApplication
.AddEnvironmentVariables() // <-- this is needed to to override settings via the Azure Portal App Settings
.Build();
// Add LoggerFactory
// Add LoggerFactory and Logger
var factory = new LoggerFactory();
serviceCollection.AddSingleton(factory
services.AddSingleton(factory
.AddConsole(configuration.GetSection("Logging"))
.AddDebug()
.AddAzureWebAppDiagnostics()
);
services.AddSingleton(factory.CreateLogger("WireMock.Net Logger"));
serviceCollection.AddSingleton(factory.CreateLogger("WireMock.Net Logger"));
// Add ApplicationInsights
services.AddApplicationInsightsTelemetry();
// Add access to generic IConfigurationRoot
serviceCollection.AddSingleton(configuration);
services.AddSingleton(configuration);
// Add access to IFluentMockServerSettings
var settings = configuration.GetSection("FluentMockServerSettings").Get<FluentMockServerSettings>();
serviceCollection.AddSingleton<IFluentMockServerSettings>(settings);
services.AddSingleton<IFluentMockServerSettings>(settings);
// Add services
serviceCollection.AddTransient<IWireMockService, WireMockService>();
services.AddTransient<IWireMockService, WireMockService>();
// Add app
serviceCollection.AddTransient<App>();
services.AddTransient<App>();
}
}
}

View File

@@ -16,7 +16,8 @@
"commandName": "IISExpress",
"launchUrl": "__admin/settings",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
"ASPNETCORE_ENVIRONMENT": "Development",
"ApplicationInsights:InstrumentationKey": "..."
}
},
"WireMock.Net.WebApplication": {
@@ -24,14 +25,16 @@
"launchBrowser": true,
"launchUrl": "__admin/settings",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
"ASPNETCORE_ENVIRONMENT": "Development",
"ApplicationInsights:InstrumentationKey": "..."
},
"applicationUrl": "http://localhost:56514/"
},
"IIS": {
"commandName": "IIS",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "development"
"ASPNETCORE_ENVIRONMENT": "development",
"ApplicationInsights:InstrumentationKey": "..."
}
}
}

View File

@@ -1,24 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFrameworks>netcoreapp2.0;netcoreapp2.1</TargetFrameworks>
<RuntimeIdentifiers>win10-x64</RuntimeIdentifiers>
<TargetFramework>netcoreapp2.1</TargetFramework>
<!--<RuntimeIdentifiers>win10-x64</RuntimeIdentifiers>-->
<StartupObject>WireMock.Net.WebApplication.Program</StartupObject>
<AssemblyName>WireMock.Net.WebApplication</AssemblyName>
<RootNamespace>WireMock.Net.WebApplication</RootNamespace>
<UserSecretsId>efcf4a18-fd7c-4622-825d-336d65290599</UserSecretsId>
</PropertyGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp2.0'">
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.2" />
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.8" />
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp2.1'">
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.4" />
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.1.5" />
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.1.1" />
</ItemGroup>
<ItemGroup>
@@ -32,4 +27,8 @@
</Content>
</ItemGroup>
<ItemGroup>
<WCFMetadata Include="Connected Services" />
</ItemGroup>
</Project>

View File

@@ -44,10 +44,10 @@ namespace WireMock.Net.WebApplication
_logger.LogError(formatString, args);
}
public void DebugRequestResponse(LogEntryModel logEntryModel, bool isAdminrequest)
public void DebugRequestResponse(LogEntryModel logEntryModel, bool isAdminRequest)
{
string message = JsonConvert.SerializeObject(logEntryModel, Formatting.Indented);
_logger.LogDebug("Admin[{0}] {1}", isAdminrequest, message);
_logger.LogDebug("Admin[{0}] {1}", isAdminRequest, message);
}
}

View File

@@ -1,4 +1,4 @@
{
{
"Logging": {
"IncludeScopes": false,
"Debug": {
@@ -16,5 +16,8 @@
"AdminUsername": "a",
"AdminPassword": "b",
"StartAdminInterface": true
},
"ApplicationInsights": {
"InstrumentationKey": ""
}
}