我正在开发一个使用Topshelf作为服务托管的ASP.NET Core Web API项目。当我从调试器中启动服务时,Swagger页面会在Internet Explorer中打开。如何更改设置,使其在Chrome中打开?
我正在开发一个使用Topshelf作为服务托管的ASP.NET Core Web API项目。当我从调试器中启动服务时,Swagger页面会在Internet Explorer中打开。如何更改设置,使其在Chrome中打开?
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<add key="WebSiteBinding" value="http://localhost:63037"/>
<add key="Environment" value="LOCAL"/>
<add key="ServiceName" value="Debug"/>
<add key="ServiceDisplayName" value="Debug"/>
</appSettings>
</configuration>
class ApiService
{
private string _url;
private IWebHost _host;
public void Start(string[] args)
{
_url = ConfigurationManager.AppSettings["WebSiteBinding"];
_host = BuildWebHost(args);
_host.Start();
#if DEBUG
System.Diagnostics.Process.Start(_url);
#endif
}
public void Stop()
{
_host.Dispose();
}
public IWebHost BuildWebHost(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>()
.UseNLog()
.UseHttpSys(options =>
{
options.Authentication.Schemes = AuthenticationSchemes.NTLM;
options.Authentication.AllowAnonymous = true;
options.UrlPrefixes.Add(_url);
})
.Build();
}