【发布时间】:2013-07-25 18:16:14
【问题描述】:
我使用 SignalR、Visual Studio 2013(但应用程序是 2012 年)、框架 4.5 创建了简单的聊天应用程序。
我只使用 ASP.NET 网络表单(不是 MVC)
当我通过 Visual Studio 运行时,它可以工作。 但是当我在 IIS 中配置它时,它在页面控制台中给出了以下错误 -
GET http://localhost/chat/signalr/hubs 404 (Not Found) localhost/:30
Uncaught TypeError: Cannot read property 'client' of undefined localhost/chat/:112
'chat' 是虚拟目录的名称。
添加了后续。以及 web.config -
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
代码来自 Global.asax.cs-
protected void Application_Start(object sender, EventArgs e)
{
// Register the default hubs route: ~/signalr/hubs
RouteTable.Routes.MapHubs();
}
Index.Html 中的代码 -
<!--Reference the SignalR library. -->
<script src="Scripts/jquery.signalR-1.0.0.js"></script>
<!--Reference the autogenerated SignalR hub script. -->
<script src="signalr/hubs"></script>
我也试过了,但没有成功-
<script src="<%= ResolveUrl("~/signalr/hubs") %>" type="text/javascript"></script>
注意 - 我指的是http://www.codeproject.com/Articles/562023/Asp-Net-SignalR-Chat-Room 提前致谢。
【问题讨论】:
-
我已经尝试了以下链接中的所有解决方案 - github.com/SignalR/SignalR/wiki/Faq
标签: .net iis-7 signalr .net-4.5 windows-7-x64