如何在服务结构ASP.NET Core 2中使用WebListenerCommunicationListener
我刚刚创建了我的第一个ASP.NET Core 2无状态服务结构可靠服务,但我注意到的第一件事是现在默认情况下使用KestrelCommunicationListener
insted的WebListenerCommunicationListener
在核心1.X.它似乎已从服务结构aspnetcore库中删除。如何在服务结构ASP.NET Core 2中使用WebListenerCommunicationListener
这不会让我在相同的物理或虚拟机上配置多个进程,以便在同一个端口上托管Web应用程序,并通过唯一的URL路径或主机名消除歧义。这些功能在Service Fabric中用于托管同一集群中的多个网站很有用。
有谁知道我是否错过了某些东西或是否有解决方法?
感谢
按照SDK 2.7.198的发布说明,Weblistener尚不支持asp.net核2.0。由PM
在ASP.NET 2.0核心提供”
回答的Microsoft.AspNetCore.Server.WebListener包已被合并Microsoft.Net.Http.Server到一个所谓的新包装Microsoft.AspNetCore.Server.HttpSys(aspnet/Announcements#211)。Service Fabric尚未为此提供集成包,因此如果您使用的是WebListener,则需要暂时保留在版本1.xx上。新的Microsoft.AspNetCore.Server.HttpSys软件包将支持下一个SDK功能版本(Azure/service-fabric-aspnetcore#15)。“
根据2017年9月25日发布的SDK版本2.8.0的发布说明https://msdnshared.blob.core.windows.net/media/2017/10/Microsoft-Azure-Service-Fabric-Release-Notes-SDK-2.8.0-Runtime-6.0.0.pdf,现在可以使用该版本。
每发行说明:
在ASP.NET 2.0的核心,在WebListener服务器被重新包装并更名 到HttpSys。用于HttpSys 服务器的Service Fabric集成软件包现已推出:Microsoft.ServiceFabric.AspNetCore.HttpSys。 该软件包包含一个用于HttpSys的重命名的ICommunicationListener实现 :HttpSysCommunicationListener。
如果您正在使用WebListener并希望升级到ASP.NET 核2.0,使用Microsoft.ServiceFabric.AspNetCore.HttpSys包 而不是Microsoft.ServiceFabric.AspNetCore.WebListener包。
protected override IEnumerable<ServiceInstanceListener> CreateServiceInstanceListeners() { return new ServiceInstanceListener[] { new ServiceInstanceListener(serviceContext => new HttpSysCommunicationListener(serviceContext, "ServiceEndpoint", (url, listener) => new WebHostBuilder() .UseHttpSys() .ConfigureService( service => services .AddSingleton<StatelessServiceContext>(serviceContext)) .UseContentRoot(Directory.GetCurrentDirectory()) .UseServiceFabricIntegration(listener, ServiceFabricIntegrationOptions.None) .UseStartup<Startup>() .UseUrls(url) .Build())) }; }
按照最新的文档,请参阅ASP.NET Core in Service Fabric Reliable Services
HttpSys是建立在Windows HTTP服务器API。这使用IIS使用的http.sys内核驱动程序处理HTTP请求并将它们路由到运行Web应用程序的进程。 这允许同一物理或虚拟机上的多个进程在同一个端口上托管Web应用程序,并由唯一的URL路径或主机名消除歧义。这些功能在Service Fabric中用于托管同一集群中的多个网站很有用。
是不是WebListener重命名为HttpSysListener? https://开头github上。COM /天青/服务织物aspnetcore /问题/ 15 – Mardoxx