I have a SignalR Windows Service client that was calling a method on the MVC app SignalR hub that was working when it all was localhost. When I deploy the MVC app to a real server, I get 404 rrors and I am not sure what to do or how to solve.
我有一个SignalR Windows服务客户端在MVC应用程序SignalR中调用一个方法,当它全部是localhost时工作。当我将MVC应用程序部署到真实服务器时,我得到404个错误,我不知道该做什么或如何解决。
The client:
protected override async void OnStart(string[] args)
{
eventLog1.WriteEntry("In OnStart");
try
{
var hubConnection = new HubConnection("http://somesplace.com/AlphaFrontendServer/signalr", useDefaultUrl: false);
IHubProxy alphaProxy = hubConnection.CreateHubProxy("AlphaHub");
await hubConnection.Start();
await alphaProxy.Invoke("Hello", "Message from Service");
}
catch (Exception ex)
{
eventLog1.WriteEntry(ex.Message);
}
}
The Server code is:
服务器代码是:
public class AlphaHub : Hub
{
public void Hello(string message)
{
// We got the string from the Windows Service
// using SignalR. Now need to send to the clients
Clients.All.addNewMessageToPage(message);
// Send message to Windows Service
}
and
public partial class Startup
{
public void Configuration(IAppBuilder app)
{
ConfigureAuth(app);
app.MapSignalR("/signalr", new HubConfiguration());
}
}
The Hello method was being called when everything was localhost. Now it generates a 404 error:
当一切都是localhost时,正在调用Hello方法。现在它生成404错误:
StatusCode: 404, ReasonPhrase: 'Not Found', Version: 1.1, Content: System.Net.Http.StreamContent, Headers:
{
Connection: close
Cache-Control: private
Date: Tue, 11 Feb 2014 17:09:41 GMT
Server: Microsoft-IIS/8.5
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Content-Length: 3510
Content-Type: text/html; charset=utf-8
}
1 个解决方案
#1
0
You should try out the suggestions from the "404 Not Found" error section of this SignalR troubleshooting guide.
您应该尝试本SignalR故障排除指南中“404 Not Found”错误部分的建议。
Some of the possible causes for the 404 include:
404的一些可能原因包括:
- Invalid address
- Interference from other routes added before the call to MapSignalR
- Using IIS 7 or 7.5 without the update for extensionless URLs
- Corrupt/out-of-date IIS cache
在调用MapSignalR之前添加的其他路由的干扰
使用IIS 7或7.5而不更新无扩展URL
损坏/过时的IIS缓存
#1
0
You should try out the suggestions from the "404 Not Found" error section of this SignalR troubleshooting guide.
您应该尝试本SignalR故障排除指南中“404 Not Found”错误部分的建议。
Some of the possible causes for the 404 include:
404的一些可能原因包括:
- Invalid address
- Interference from other routes added before the call to MapSignalR
- Using IIS 7 or 7.5 without the update for extensionless URLs
- Corrupt/out-of-date IIS cache
在调用MapSignalR之前添加的其他路由的干扰
使用IIS 7或7.5而不更新无扩展URL
损坏/过时的IIS缓存