I am trying to deploy a SignalR site on IIS. Code all works fine in VS. But getting the 404 not found error trying to resolve signalr/hubs so far I have tri
If you are working on webforms, Please take the following steps
In the webconfig:
<validation validateIntegratedModeConfiguration="false" />
<modules runAllManagedModulesForAllRequests="true"/>
In the page add reference to hub as
<script src="/signalr/signalr/hubs"></script>
instead of
<script src="/signalr/hubs"></script>
I might be a little late but hope it helps someone. Make sure this code run on start.
Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
RouteTable.Routes.MapHubs()
End Sub
Because I added a global.asax to my application and then a codebehind but put this in Global.asax file
<%@ Application Language="VB" CodeBehind = "Global.asax.vb" %> /*This was wrong*/
So when i tried to run the application, the Application_Start in my global.asax did not initialize the hub. that's why it couldn't resolve signalr/hubs
fixed with this in my Global.asax
<%@ Application Inherits="_Global" Language="VB" %>
and this in my Global.asax.vb:
Public Class _Global
Inherits System.Web.HttpApplication
I was able to fix the 404 on ~/signalr/hubs by changing the following appSetting in web.config to "true".
<add key="owin:AutomaticAppStartup" value="false" />
Make sure your site's AppPool targets the correct version of .NET Framework.
I had no issues with routing in MVC3, but did get the path wrong. I would suggest you look at the source and see where the script is actually pointing, make sure it is resolving the application directory ok. And make sure you can physcially open the file with the correct path with your browser. E.g.
<script src="/MyWebApp/signalr/hubs" type="text/javascript"></script>
Can you open the file from a browser (replacing it with the correct subdirectory)?
If not, the hub might not be set up correct and it might point you in the right direction. Fiddler it.
The syntax I used was:
<script src="@Url.Content("~/signalr/hubs")" type="text/javascript"></script>
It might be the difference between Url.Content and ResolveUrl
Check web.config, on segment AppSettings add
<add key="owin:AutomaticAppStartup " value="false" />
on Key must be white space on the end of the name key, like @Randy H.