The sample I tried was working under my development environment in IIS7, but when I deploy it to production server,
in fiddler I can see 404 Error regarding 'signalr/hubs', anyone can help with this one?
<script src="signalr/hubs"></script>
<script type="text/javascript">
$(function () {
var worker = $.connection.worker;
worker.notify = function (data) {
$('#notifications').text(data);
};
worker.setProgress = function (val) {
$('#progressbar').html(val + '%');
};
$.connection.hub.start();
$('#startWorkTrigger').click(function () {
worker.work({ Name: "TC Worker 1" });
});
});
</script>
</head>
<body>
<div id="progressbar" style="width: 200px;">
</div>
<div id="notifications" style="width: 200px;">
</div>
<button id="startWorkTrigger">
Start work</button>
</body>
----------------------------------------
namespace Sample.Hubs
{
public class Person
{
public string Name { get; set; }
}
[HubName("worker")]
public class ProcessHub : Hub
{
public void Work(Person p)
{
this.Caller.notify("Started work, " + p.Name + "...");
for (int i = 0; i <= 100; i++)
{
this.Clients.setProgress(i);
Thread.Sleep(100);
}
this.Caller.notify("Finished!");
}
}
}
showen
Member
11 Points
8 Posts
SignalR not working on production server
Feb 22, 2012 07:38 AM|LINK
The sample I tried was working under my development environment in IIS7, but when I deploy it to production server, in fiddler I can see 404 Error regarding 'signalr/hubs', anyone can help with this one? <script src="signalr/hubs"></script> <script type="text/javascript"> $(function () { var worker = $.connection.worker; worker.notify = function (data) { $('#notifications').text(data); }; worker.setProgress = function (val) { $('#progressbar').html(val + '%'); }; $.connection.hub.start(); $('#startWorkTrigger').click(function () { worker.work({ Name: "TC Worker 1" }); }); }); </script> </head> <body> <div id="progressbar" style="width: 200px;"> </div> <div id="notifications" style="width: 200px;"> </div> <button id="startWorkTrigger"> Start work</button> </body> ---------------------------------------- namespace Sample.Hubs { public class Person { public string Name { get; set; } } [HubName("worker")] public class ProcessHub : Hub { public void Work(Person p) { this.Caller.notify("Started work, " + p.Name + "..."); for (int i = 0; i <= 100; i++) { this.Clients.setProgress(i); Thread.Sleep(100); } this.Caller.notify("Finished!"); } } }Dave Sussman
All-Star
37716 Points
5005 Posts
ASPInsiders
MVP
Re: SignalR not working on production server
Feb 22, 2012 07:57 AM|LINK
You might need to configure IIS7 to use managed modules for all requests. try this in web.config:
showen
Member
11 Points
8 Posts
Re: SignalR not working on production server
Feb 23, 2012 03:32 AM|LINK
This works fine.
BTW, after I updated the SignalR to the lastest 0.4, the application dosen't work any more, lookes like somthing to do with the client js file.
Dave Sussman
All-Star
37716 Points
5005 Posts
ASPInsiders
MVP
Re: SignalR not working on production server
Feb 23, 2012 08:02 AM|LINK
Did the update definitely update the js files?
If the problem persists, post it to the issues on the SignalR site; David is really helpful; he's helped me out with my issues really well.