Note that there are some explanatory texts on larger screens.

plurals
  1. POSignalR hosted in MVC in Azure emulator has cross domain problems from JS client
    primarykey
    data
    text
    <p>I've got a SignalR hub (named EventHub) hosted in an Azure web role that's an MVC 4 application running in the emulator at 127.0.0.2:81. In my Application_Start, I have:</p> <pre><code>RouteTable.Routes.MapHubs(new HubConfiguration { EnableCrossDomain = true }); </code></pre> <p>in my JS client running via IIS at localhost:1003, I have:</p> <pre><code>$.connection.hub.url = 'http://127.0.0.2:81/signalr'; $.connection.hub.start().done(alert('connected')); </code></pre> <p>My client can connect to the hub and call methods on it, but in the console, I'm seeing:</p> <pre><code>XMLHttpRequest cannot load http://127.0.0.2:81/signalr/reconnect?transport=longPolling&amp;connectionToken…&amp;tid=0&amp;_=1380138173967. Origin http://localhost:1003 is not allowed by Access-Control-Allow-Origin. </code></pre> <p>The client eventually disconnects itself. If I use the same client, and a nearly identical hub implementation and run it in a stand-alone MVC app at localhost:62835, I get no cross-origin errors at all. I'm running this in Chrome v29. I do not have any custom headers specified nor have I set jquery cors support to true.</p> <p>Is there some kink that the azure emulator is causing? And if so, is there some way around it?</p> <p><strong>UPDATE:</strong></p> <p>I've published my web role to Azure, and cors appears to be working in that environment. In addition, Chrome is now using websockets to connect instead of the longpolling that was being attempted when connecting to the emulator-hosted site.</p> <p>I would still like to be able to run this via the emulator for local testing, so if anyone has any ideas on how to get that working, I'd be grateful.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload