如何在IIS 8中启用WebSockets?

时间:2014-01-29 22:15:56

标签: asp.net iis websocket signalr iis-8

我在Windows 2012,IIS 8服务器上部署了SignalR示例应用程序。

我安装了WebSocket协议支持,如下所述:http://www.iis.net/learn/get-started/whats-new-in-iis-8/iis-80-websocket-protocol-support

但我仍然无法使用WebSockets进行连接。以下是我部署的应用程序:http://machines-staging.dgplatformer.net/SignalRSamples/Hubs/HubConnectionAPI/

消息日志:

[20:05:12 GMT-0200 (E. South America Daylight Time)]: disconnected => connecting undefined
[20:05:12 GMT-0200 (E. South America Daylight Time)]: connecting => connected 49b8a6d4-41ef-4ff8-8f3d-8e1a513649bb
[20:05:12 GMT-0200 (E. South America Daylight Time)]: 49b8a6d4-41ef-4ff8-8f3d-8e1a513649bb OnConnected
started transport: **serverSentEvents** 49b8a6d4-41ef-4ff8-8f3d-8e1a513649bb

我发现这个部署在Azure上(进行比较):http://signalr-test1.cloudapp.net:82/Hubs/HubConnectionAPI/

日志:

20:11:18 GMT-0200 (E. South America Daylight Time) stateChanged: disconnected => connecting
20:11:18 GMT-0200 (E. South America Daylight Time) starting state: connecting
20:11:19 GMT-0200 (E. South America Daylight Time) stateChanged: connecting => connected
20:11:19 GMT-0200 (E. South America Daylight Time) 68b036a9-4e08-49a4-b11c-9ba15718e2d9 OnConnected
20:11:19 GMT-0200 (E. South America Daylight Time) started transport: **webSockets** 68b036a9-4e08-49a4-b11c-9ba15718e2d9

在IIS8服务器上使用WebScokets需要做什么?

这是IIS日志:

Fields: date time s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User-Agent) cs(Referer) sc-status sc-substatus sc-win32-status time-taken

2014-01-29 22:14:13 192.168.0.33 GET /SignalRSamples/signalr/connect transport=webSockets&connectionToken=5O27InctUL0WgtbDF6bF8BhVEzndWHHsxlcZV3Ov1Oi3XiReG5eLZmtvSjL3AoqoKAAIStCAIt8uAnPsBhqSe1aL24Uv0cnAv5%2FP%2BgsEseUC%2BOj2if%2Bl9DMsvc%2BkI3N7&connectionData=%5B%7B%22name%22%3A%22hubconnectionapi%22%7D%5D&tid=2 80 - 186.231.71.234 Mozilla/5.0+(Windows+NT+6.2;+WOW64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/32.0.1700.76+Safari/537.36 - 400 0 0 155

1 个答案:

答案 0 :(得分:1)

实际上我发现问题与我的办公室网络有关,而不是与服务器有关。我可以使用WebSockets与我的智能手机使用3G网络连接=)