Question

OK this seems to be a question about differences between running via VS2012 (where it runs fine) vs. once deployed on my local win7 IIS 7.5 machine.

NB - Ultimately running through fiddler the call to /signalr/hubs is returning a 404

The error being reported in javascript is:

messageHub is undefined

where

var messageHub = $.connection.startHub;

and in my hub class

[HubName("startHub")]
public class ourHub : Hub
{
    ....

I'm calling MapHubs in App Start

    protected void Application_Start(object sender, EventArgs e)
    {
        //Required for SignalR
        RouteTable.Routes.MapHubs();
    }

and I have the RAMFAR (runAllManagedModulesForAllRequests="true">) setting in web.config...

<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
  <modules runAllManagedModulesForAllRequests="true">
    <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" preCondition="managedHandler" />
    <add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" preCondition="managedHandler" />
    <add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah" preCondition="managedHandler" />
</modules>

The issue would seem to be around how I define the auto-generated signalr/hubs

It's an asp.net app (not mvc) so the troubleshooting page (https://github.com/SignalR/SignalR/wiki/Faq) seems to state

<script type="text/javascript" src='<%= ResolveClientUrl("~/signalr/hubs") %>'></script>

which neither works in debug through VS or when deployed I've also tried

<script src="/signalr/hubs"></script>  (also with the type declaration)
<script src="~/signalr/hubs"></script>

In other similar threads it has been mentioned to apply the hotfix http://support.microsoft.com/kb/980368 but the win7 downloads state they're not applicable to my computer...

NB SignalR version is 1.1.3.

I've also downloaded the StockTicker app which again works fine through VS, but upon deployment reports the same underlying issue, because $.connection.stockTickerMini is undefined

many thanks :)

Was it helpful?

Solution

Well, after going through the ringer and finding nothing wrong, (and creating the otherwise auto-generated hubs, with the same end result) I concluded that it was "one of those" errors and that maybe it's not the hubs at all. So I therefore unhitched SignalR altogether, and re-added via nuget. This time I wasn't getting 404 but an error generated in the hub its self (an error nothing to do with SignalR), and once that was sorted, it all hung together in debug and (vitally!) once deployed.

Wish I knew what the underlying cause was, but removing anything SignalR related and re-adding seemed to do the trick...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top