问题描述
我在VS2012中创建一个Windows托管SignalR集线器:
I have a windows hosted SignalR hub created in VS2012:
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);
}
}
我已经在3个不同的PC上部署该窗口服务,它工作正常,在两台PC,但另一方面,我得到HTTP 503服务不可用,当我试图浏览的http://本地主机: 8080 / signalr /集线器
在code在所有3台PC执行抛出也不例外。
No exception thrown when the code is executed on all 3 PCs.
我已检查IIS的功能,在添加/删除Windows功能,它们都是一样的。
I have checked IIS's features in add/remove windows features, they're all the same.
我在想什么?
推荐答案
我可以用下面的设置本地瑞普这样的:1.使用的Netsh.exe或类似工具保留的http:// locahost:8080 /
2.呼叫 WebApp.Start&LT;启动&GT;(HTTP:// *:8080)
3.浏览到的http:// locahost:8080 /
I was able to repro this locally with the following setup:1. Use NetSh.exe or similar tool to reserve http://locahost:8080/
2. Call WebApp.Start<Startup>("http://*:8080")
3. Browse to http://locahost:8080/
什么情况是,HTTP.SYS接受传入的请求,检查主机头,决定是有保留的本地主机:8080,但意识到没有应用软件正在听为localhost:8080,仅*:8080。 HTTP.SYS然后返回503。
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 then returns the 503.
解决方案:A)尝试 WebApp.Start&LT;启动&GT;(HTTP:// +:8080)
b)拆卸HTTP.SYS / Netsh的登记
Solutions:A) Try WebApp.Start<Startup>("http://+:8080")
B) Remove the Http.Sys/NetSh registration
这篇关于试图浏览signalr /集线器时,HTTP 503服务不可用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!