個人系統是win2008,iis7.部署webapi後,應用池只能用經典模式。且要添加一個映射:web
api/* 指向: C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dllapi
那爲何集成模式不行呢,微軟這麼說:websocket
http://www.asp.net/mvc/overview/older-versions-1/deployment/using-asp-net-mvc-with-different-versions-of-iis-csmvc
它提供兩個方案,一、使用文件後綴名,好比 /Product.mvc/Details/3 添加.mvc 或 .aspx等後綴。app
二、添加對 * 的映射到asp.net。 (還不知道會不會對靜態文件有影響)asp.net
總之,我沒有測試上面的方法。退一步,仍是改爲經典模式算了。less
SingalR呢,直接要求IIS8.0才支持websocket. 而IIS7不能升級,除非升級系統。socket
微軟說:"Note that for SignalR to use WebSockets, Windows Server 2012 or Windows 8 is required"測試
for SignalR to use WebSocket, IIS 8 or IIS 8 Express must be used, the server must be using Windows 8, Windows Server 2012, or later, and WebSocket must be enabled in IIS. For information on how to enable WebSocket in IIS
ui
IIS 8 or IIS 8 Express.
IIS 7 and 7.5. Support for extensionless URLs is required.
IIS must be running in integrated mode; classic mode is not supported. Message delays of up to 30 seconds may be experienced if IIS is run in classic mode using the Server-Sent Events transport.
The hosting application must be running in full trust mode.
看到啦,不只是IIS8,而且是集成模式才行。不然只能用其它方式進行鏈接了。
完全打消了個人念頭,實在想添加websocket的應用時,仍是用socket.io等其它辦法吧!