I've just started using SignalR
with C#, seems intresting.
I've created an ASP.NET Empty Web Application
and followed the tutorial mentioned below
I found Getting Started with SignalR tutorial on MSDN.
I've done all the steps mentioned in the tutorial. It seems to work on my local machine when it is being run on ASP.NET Development Server
.
But when i Deploy the project to my IIS7
, it doesnot work.
When i checked with the fiddler, it has the results of 404 on all the scripts files included into the html page.
Here is what the fiddler has shown
Even i've found some suggestions from the posts on StackOverflow, which doesnot seem to work when i change my web.config
file as well.
finally i've modified my web.config
according to the FAQ's of SignalR.
Here is my web.config file:
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
</modules>
</system.webServer>
</configuration>
Global.asax file:
public class Global : System.Web.HttpApplication
{
protected void Application_Start(object sender, EventArgs e)
{
// Register the default hubs route: ~/signalr/hubs
RouteTable.Routes.MapHubs();
}
// Rest of the Methods(Session_Start,Application_BeginRequest..) are empty
}
I've also changed
<script type="text/javascript" src="/signalr/hubs"></script>
to
<script type="text/javascript" src='<%= ResolveClientUrl("~/signalr/hubs") %>'></script>
and
<script type="text/javascript" src='<%= ResolveUrl("~/signalr/hubs") %>'></script>
None of them seem to work either.
Do not hesitate to ask if any information required.
Any help would be appreciated
Update
As per the Aron suggestion, the following change is made to the Global.asax
file
RouteTable.Routes.IgnoreRoute("Scripts/");
and now, the jQuery
scripts seems to be loading and working as well.
Here is the updated error message when hosted on IIS, its from the Console
tab of the Browser window.
SCRIPT5022: SignalR: Error loading hubs. Ensure your hubs reference is correct, e.g. <script src='/signalr/hubs'></script>.
There may have been problem with your IIS settings. Please try adding MIME type for .js extension. Refer this link
404 error may occure when IIS could not handle extension less url
http://support.microsoft.com/kb/980368
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With