[英]HTTP 503 Service is unavailable when trying to browse signalr/hubs
I have a windows hosted SignalR hub created in VS2012: 我在VS2012中创建了一个Windows托管的SignalR集线器:
public class Startup
{
public void Configuration(IAppBuilder app)
{
app.UseCors(CorsOptions.AllowAll);
app.MapSignalR();
}
}
public static class SignalR
{
public static void Start()
{
const string url = "http://*:8080";
WebApp.Start<Startup>(url);
}
}
public class Broadcaster : Hub
{
public void SendDownloadResult(bool result, string device, string description, string connectionId, string task)
{
var context = GlobalHost.ConnectionManager.GetHubContext<Broadcaster>();
context.Clients.Client(connectionId).sendDownloadResult(result, device, description, task);
}
}
I have deployed this windows service on 3 different PCs, it works fine on two PCs, but on the other, I get HTTP 503 Service is unavailable when I try to browse http://localhost:8080/signalr/hubs
我已经在3台不同的PC上部署了这个Windows服务,它可以在两台PC上正常工作,但另一方面,当我尝试浏览http://localhost:8080/signalr/hubs
时,我得到HTTP 503服务不可用
No exception thrown when the code is executed on all 3 PCs. 在所有3台PC上执行代码时不会抛出异常。
I have checked IIS's features in add/remove windows features, they're all the same. 我已经在添加/删除Windows功能中检查了IIS的功能,它们都是一样的。
What am I missing? 我错过了什么?
I was able to reproduce this locally with the following setup: 我能够通过以下设置在本地重现:
http://localhost:8080/
使用NetSh.exe或类似工具保留http://localhost:8080/
WebApp.Start<Startup>("http://*:8080")
调用WebApp.Start<Startup>("http://*:8080")
http://localhost:8080/
浏览到http://localhost:8080/
What happens is that Http.Sys accepts the incoming request, examines the host header, decides that there is a reservation for localhost:8080, but realizes that no application is listening to localhost:8080, only *:8080. 会发生什么事情是Http.Sys接受传入的请求,检查主机头,确定有localhost:8080的预留,但意识到没有应用程序正在侦听localhost:8080,只有*:8080。 Http.Sys then returns the 503. Http.Sys然后返回503。
Solutions: 解决方案:
WebApp.Start<Startup>("http://+:8080")
试试WebApp.Start<Startup>("http://+:8080")
I also had same issue. 我也有同样的问题。 I rectified it by changing 我通过改变纠正了它
const string url = "http://*:8080";
TO 至
const string url = "http://+:8080"; // * replaced by +
I also realised, that in one of the PCs, port 8080 was in use. 我也意识到,在其中一台PC中,端口8080正在使用中。
Changing the port from 更改端口
const string url = "http://*:8080";
to 至
const string url = "http://*:8088";
solved the issue 解决了这个问题
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.