Signalr /集线器在IIS 7中不加载,但在Visual Studio中正常工作 [英] Signalr/Hub not loading in IIS 7 but working correctly in Visual Studio
问题描述
我的工作对使用SignalR在ASP .NET 4.0框架的Web应用程序,已经从的NuGet包安装。当调试或没有在本地调试运行应用程序它工作正常。然而,当它被部署到生产服务器是无法找到被动态地注入HttpHandlers的在信号/集线器
文件。由于它的动态性质它必须动态创建的,所以我不能工作文件只复制到该项目无论是。
I am working on a Web Application on the Asp .Net 4.0 framework that uses SignalR, having installed it from the Nuget package. When I debug or run the application without debugging locally it works correctly. However, when it is deployed to the production server it is unable to find the signal/hubs
file that is being dynamically injected into the httphandlers. Due to it's dynamic nature it has to be created on the fly, so I can't just copy the working file into the project either.
我试图加载文件的以下方法:
I have tried the following methods of loading the file:
<script src="/signalr/hubs" type="text/javascript"></script>
<script src="signalr/hubs" type="text/javascript"></script>
而在code背后:
And in the code behind:
ScriptManager.GetCurrent(Page).Scripts.Add(new ScriptReference("~/signalr/hubs"));
所有这些服务器上的本地,但不起作用。那就是在HTML格式呈现的路径看起来是正确的,但没有文件存在,提供了404错误。如果它的事项,该服务器已经给应用程序完全信任和应用程序被运行在IIS使用子域名下的另一个网站的应用程序。
All of these work locally but not on the server. The path that is rendered in the html looks correct, but there is no file there, delivering a 404 error. If it matters, the server has given the application Full Trust and the application is being run as an application under another site in IIS that uses a subdomain.
推荐答案
该问题是由在web.config中设置下列标志解决了。
The problem was solved by setting the following flags in the web.config.
<configuration>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<modules runAllManagedModulesForAllRequests="true">
</modules>
</system.webServer>
</configuration>
由于某些原因的NuGet没有设定ELMAH或SignalR这些值
For some reason Nuget did not set these values for Elmah or SignalR
这篇关于Signalr /集线器在IIS 7中不加载,但在Visual Studio中正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!