mirror of
https://github.com/nsnail/Ocelot.git
synced 2025-06-20 15:48:16 +08:00
messing around with the proxy mdh the proxy middleware
This commit is contained in:
34
test/Ocelot.AcceptanceTests/Fake/FakeService.cs
Normal file
34
test/Ocelot.AcceptanceTests/Fake/FakeService.cs
Normal file
@ -0,0 +1,34 @@
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
|
||||
namespace Ocelot.AcceptanceTests.Fake
|
||||
{
|
||||
public class FakeService
|
||||
{
|
||||
private Task _handler;
|
||||
private IWebHost _webHostBuilder;
|
||||
|
||||
public void Start(string url)
|
||||
{
|
||||
_webHostBuilder = new WebHostBuilder()
|
||||
.UseKestrel()
|
||||
.UseContentRoot(Directory.GetCurrentDirectory())
|
||||
.UseIISIntegration()
|
||||
.UseUrls(url)
|
||||
.UseStartup<FakeStartup>()
|
||||
.Build();
|
||||
|
||||
_handler = Task.Run(() => _webHostBuilder.Run());
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
{
|
||||
if(_webHostBuilder != null)
|
||||
{
|
||||
_webHostBuilder.Dispose();
|
||||
_handler.Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user