Viralwarrior012
Viralwarrior012

Reputation: 195

SignalR MVC crossdomain $.connection is undefined

i'm having a pretty annoying issue with signalr in my mvc application.

I've got a signalr server in it's own project under (localhost:49648)

The application that is calling said server references the following from it:

<script src="http://localhost:49648/Scripts/jquery.signalR-2.2.0.js"></script> 
<script src="http://localhost:49648/signalr/hubs"></script>

JQuery 2.1.4 is also referenced at the top of my application (so i've ruled out script overlapping)

Essentially, $.connection is always returned as undefined in MVC only. The required files are indeed loaded when i check the source files (debug). The server does accept cross-domain requests. I've also tried running the exact code written in the MVC view in a standard html file at the project root and it works without issue.

Any idea why MVC doesn't recognize the connection?

Upvotes: 0

Views: 295

Answers (1)

Viralwarrior012
Viralwarrior012

Reputation: 195

After all this running around, the preformated master page layout created by my colleagues referenced JQuery twice, once at top (which i saw) and one at bottom (which i didn't). I created a bottomScript section at the bottom of the master page and loaded signalr in there and now everything works great.

Upvotes: 1

Related Questions