mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-01-16 07:06:54 +01:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7ad8b60fbd |
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"ProviderId": "Microsoft.ApplicationInsights.ConnectedService.ConnectedServiceProvider",
|
||||||
|
"Version": "8.14.20131.1",
|
||||||
|
"GettingStartedDocument": {
|
||||||
|
"Uri": "https://go.microsoft.com/fwlink/?LinkID=798432"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
using System;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.Configuration;
|
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
using System;
|
||||||
using WireMock.Settings;
|
using WireMock.Settings;
|
||||||
|
|
||||||
namespace WireMock.Net.WebApplication
|
namespace WireMock.Net.WebApplication
|
||||||
@@ -21,7 +21,7 @@ namespace WireMock.Net.WebApplication
|
|||||||
serviceProvider.GetService<App>().Run();
|
serviceProvider.GetService<App>().Run();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ConfigureServices(IServiceCollection serviceCollection)
|
private static void ConfigureServices(IServiceCollection services)
|
||||||
{
|
{
|
||||||
// Build configuration
|
// Build configuration
|
||||||
var configuration = new ConfigurationBuilder()
|
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
|
.AddEnvironmentVariables() // <-- this is needed to to override settings via the Azure Portal App Settings
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
// Add LoggerFactory
|
// Add LoggerFactory and Logger
|
||||||
var factory = new LoggerFactory();
|
var factory = new LoggerFactory();
|
||||||
serviceCollection.AddSingleton(factory
|
services.AddSingleton(factory
|
||||||
.AddConsole(configuration.GetSection("Logging"))
|
.AddConsole(configuration.GetSection("Logging"))
|
||||||
.AddDebug()
|
.AddDebug()
|
||||||
.AddAzureWebAppDiagnostics()
|
.AddAzureWebAppDiagnostics()
|
||||||
);
|
);
|
||||||
|
services.AddSingleton(factory.CreateLogger("WireMock.Net Logger"));
|
||||||
|
|
||||||
serviceCollection.AddSingleton(factory.CreateLogger("WireMock.Net Logger"));
|
// Add ApplicationInsights
|
||||||
|
services.AddApplicationInsightsTelemetry();
|
||||||
|
|
||||||
// Add access to generic IConfigurationRoot
|
// Add access to generic IConfigurationRoot
|
||||||
serviceCollection.AddSingleton(configuration);
|
services.AddSingleton(configuration);
|
||||||
|
|
||||||
// Add access to IFluentMockServerSettings
|
// Add access to IFluentMockServerSettings
|
||||||
var settings = configuration.GetSection("FluentMockServerSettings").Get<FluentMockServerSettings>();
|
var settings = configuration.GetSection("FluentMockServerSettings").Get<FluentMockServerSettings>();
|
||||||
serviceCollection.AddSingleton<IFluentMockServerSettings>(settings);
|
services.AddSingleton<IFluentMockServerSettings>(settings);
|
||||||
|
|
||||||
// Add services
|
// Add services
|
||||||
serviceCollection.AddTransient<IWireMockService, WireMockService>();
|
services.AddTransient<IWireMockService, WireMockService>();
|
||||||
|
|
||||||
// Add app
|
// Add app
|
||||||
serviceCollection.AddTransient<App>();
|
services.AddTransient<App>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -16,7 +16,8 @@
|
|||||||
"commandName": "IISExpress",
|
"commandName": "IISExpress",
|
||||||
"launchUrl": "__admin/settings",
|
"launchUrl": "__admin/settings",
|
||||||
"environmentVariables": {
|
"environmentVariables": {
|
||||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
"ASPNETCORE_ENVIRONMENT": "Development",
|
||||||
|
"ApplicationInsights:InstrumentationKey": "..."
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"WireMock.Net.WebApplication": {
|
"WireMock.Net.WebApplication": {
|
||||||
@@ -24,14 +25,16 @@
|
|||||||
"launchBrowser": true,
|
"launchBrowser": true,
|
||||||
"launchUrl": "__admin/settings",
|
"launchUrl": "__admin/settings",
|
||||||
"environmentVariables": {
|
"environmentVariables": {
|
||||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
"ASPNETCORE_ENVIRONMENT": "Development",
|
||||||
|
"ApplicationInsights:InstrumentationKey": "..."
|
||||||
},
|
},
|
||||||
"applicationUrl": "http://localhost:56514/"
|
"applicationUrl": "http://localhost:56514/"
|
||||||
},
|
},
|
||||||
"IIS": {
|
"IIS": {
|
||||||
"commandName": "IIS",
|
"commandName": "IIS",
|
||||||
"environmentVariables": {
|
"environmentVariables": {
|
||||||
"ASPNETCORE_ENVIRONMENT": "development"
|
"ASPNETCORE_ENVIRONMENT": "development",
|
||||||
|
"ApplicationInsights:InstrumentationKey": "..."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,24 +1,19 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFrameworks>netcoreapp2.0;netcoreapp2.1</TargetFrameworks>
|
<TargetFramework>netcoreapp2.1</TargetFramework>
|
||||||
<RuntimeIdentifiers>win10-x64</RuntimeIdentifiers>
|
<!--<RuntimeIdentifiers>win10-x64</RuntimeIdentifiers>-->
|
||||||
<StartupObject>WireMock.Net.WebApplication.Program</StartupObject>
|
<StartupObject>WireMock.Net.WebApplication.Program</StartupObject>
|
||||||
<AssemblyName>WireMock.Net.WebApplication</AssemblyName>
|
<AssemblyName>WireMock.Net.WebApplication</AssemblyName>
|
||||||
<RootNamespace>WireMock.Net.WebApplication</RootNamespace>
|
<RootNamespace>WireMock.Net.WebApplication</RootNamespace>
|
||||||
<UserSecretsId>efcf4a18-fd7c-4622-825d-336d65290599</UserSecretsId>
|
<UserSecretsId>efcf4a18-fd7c-4622-825d-336d65290599</UserSecretsId>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp2.0'">
|
<ItemGroup>
|
||||||
<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'">
|
|
||||||
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.4" />
|
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.4" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.1.5" />
|
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.1.5" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
|
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
|
||||||
|
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.1.1" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@@ -32,4 +27,8 @@
|
|||||||
</Content>
|
</Content>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<WCFMetadata Include="Connected Services" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
@@ -44,10 +44,10 @@ namespace WireMock.Net.WebApplication
|
|||||||
_logger.LogError(formatString, args);
|
_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);
|
string message = JsonConvert.SerializeObject(logEntryModel, Formatting.Indented);
|
||||||
_logger.LogDebug("Admin[{0}] {1}", isAdminrequest, message);
|
_logger.LogDebug("Admin[{0}] {1}", isAdminRequest, message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
{
|
{
|
||||||
"Logging": {
|
"Logging": {
|
||||||
"IncludeScopes": false,
|
"IncludeScopes": false,
|
||||||
"Debug": {
|
"Debug": {
|
||||||
@@ -16,5 +16,8 @@
|
|||||||
"AdminUsername": "a",
|
"AdminUsername": "a",
|
||||||
"AdminPassword": "b",
|
"AdminPassword": "b",
|
||||||
"StartAdminInterface": true
|
"StartAdminInterface": true
|
||||||
|
},
|
||||||
|
"ApplicationInsights": {
|
||||||
|
"InstrumentationKey": ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user