Add example for Cors (#712)

* Cors

* Update Program.cs
This commit is contained in:
Stef Heyenrath
2022-01-06 15:41:47 +01:00
committed by GitHub
parent b153024de3
commit e3a693ede7
3 changed files with 100 additions and 72 deletions

View File

@@ -1,6 +1,7 @@
#if USE_ASPNETCORE
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
@@ -8,10 +9,10 @@ using JetBrains.Annotations;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.DependencyInjection;
using Stef.Validation;
using WireMock.Logging;
using WireMock.Owin.Mappers;
using WireMock.Util;
using Stef.Validation;
namespace WireMock.Owin
{
@@ -54,7 +55,7 @@ namespace WireMock.Owin
// a filesystem handler).
if (string.IsNullOrEmpty(AppContext.BaseDirectory))
{
builder.UseContentRoot(System.IO.Directory.GetCurrentDirectory());
builder.UseContentRoot(Directory.GetCurrentDirectory());
}
_host = builder

View File

@@ -46,10 +46,7 @@ namespace WireMock.Owin
[PublicAPI]
public Task StartAsync()
{
return Task.Run(() =>
{
StartServers();
}, _cts.Token);
return Task.Run(StartServers, _cts.Token);
}
[PublicAPI]