托管在IIS上的ASP.NET 5(DNX)中的WebSocket不工作

托管在IIS上的ASP.NET 5(DNX)中的WebSocket不工作,iis,websocket,signalr,asp.net-core,dnx,Iis,Websocket,Signalr,Asp.net Core,Dnx,我的网站使用带有RC1-Update1的ASP.NET 5,与客户端的一些通信通过web套接字进行(使用信号器) 在测试期间,我发现在IIS(或IIS Express)上运行时,通信无法通过套接字工作。信号机回退到长轮询 信号员日志: SignalR: Client subscribed to hub 'chathub'. SignalR: Negotiating with '/signalr/signalr/negotiate?clientProtocol=1.5&connection

我的网站使用带有RC1-Update1的ASP.NET 5,与客户端的一些通信通过web套接字进行(使用信号器)

在测试期间,我发现在IIS(或IIS Express)上运行时,通信无法通过套接字工作。信号机回退到长轮询

信号员日志:

SignalR: Client subscribed to hub 'chathub'.
SignalR: Negotiating with '/signalr/signalr/negotiate?clientProtocol=1.5&connectionData=%5B%7B%22name%22%3A%22chathub%22%7D%5D'.
SignalR: serverSentEvents transport starting.
SignalR: Attempting to connect to SSE endpoint 'http://localhost:31650/signalr/signalr/connect?transport=serverSentEvents&c…wVlnXCY8bI7R8E&connectionData=%5B%7B%22name%22%3A%22chathub%22%7D%5D&tid=2'.
SignalR: serverSentEvents transport timed out when trying to connect.
SignalR: EventSource calling close().
SignalR: serverSentEvents transport failed to connect. Attempting to fall back.
SignalR: foreverFrame transport starting.
SignalR: Forever Frame is not supported by SignalR on browsers with SSE support.
SignalR: foreverFrame transport failed to connect. Attempting to fall back.
SignalR: longPolling transport starting.
SignalR: Opening long polling request to 'http://localhost:31650/signalr/signalr/connect?transport=longPolling&client…8WRrhWwVlnXCY8bI7R8E&connectionData=%5B%7B%22name%22%3A%22chathub%22%7D%5D'.
SignalR: Long poll complete
经过长时间的调试,我使用以下命令行直接通过dnx(无IIS或任何其他)启动了我的网站:

dnx web
web套接字可以开箱即用,没有任何问题

在我研究解决方案的过程中,我发现在带有socket.io web应用程序的NodeJ中,必须禁用IIS中的web套接字,以便将它们正确地转发到NodeJ(链接到资源),因此我尝试了同样的方法并得到了错误(只要web.config中存在
webSocket
元素,就会发生错误):

试图确定承载应用程序的DNX进程的进程id时出错

My web.config:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <system.webServer>
        <handlers>
            <add name="httpPlatformHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified" />
        </handlers>
        <httpPlatform processPath="%DNX_PATH%" arguments="%DNX_ARGS%" forwardWindowsAuthToken="false" stdoutLogEnabled="true" startupTimeLimit="3600" />
        <staticContent>
            <!-- A bunch of mime types (no difference if removed) -->
        </staticContent>
        <webSocket enabled="false" />
    </system.webServer>
</configuration>


问题在于缺少包
Microsoft.AspNet.WebSockets.Server
和调用
startup.cs
app.UseWebSockets()


问题得以解决,这要归功于@davidfowl。

效果很好!我丢失这个包裹也有同样的问题。谢谢