简体   繁体   English

尝试浏览信号器/集线器时,HTTP 503服务不可用

[英]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: 我能够通过以下设置在本地重现:

  1. Use NetSh.exe or similar tool to reserve http://localhost:8080/ 使用NetSh.exe或类似工具保留http://localhost:8080/
  2. Call WebApp.Start<Startup>("http://*:8080") 调用WebApp.Start<Startup>("http://*:8080")
  3. Browse to 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: 解决方案:

  1. Try WebApp.Start<Startup>("http://+:8080") 试试WebApp.Start<Startup>("http://+:8080")
  2. Remove the Http.Sys/NetSh registration 删除Http.Sys / NetSh注册

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.

相关问题 HTTP 503:服务不可用 - HTTP 503 : Service Unavailable Visual Studio IIS HTTP 503 服务不可用 - Visual Studio IIS HTTP 503 Service Unavailable HTTP 错误 503。该服务在 IIS 中不可用? - HTTP Error 503. The service is unavailable in IIS? 使用 ApplicationPoolIdentity 或自定义帐户时,IIS8“HTTP 错误 503 - 服务不可用”,但在使用 NetworkService 时则不然 - IIS8 'HTTP Error 503 - Service unavailable' when using ApplicationPoolIdentity or a custom account, but not when using NetworkService HTTP错误503。当端口80已空闲时,该服务不可用 - HTTP Error 503. The service is unavailable when port 80 is already free IIS 停止并出现错误消息“HTTP 错误 503。服务不可用” - IIS stopped and error message "HTTP Error 503. The service is unavailable" 仅当使用NetworkService时,站点才不会使用ApplicationPoolIdentity在本地启动:“ HTTP错误503。该服务不可用。” - Site wont start on local using ApplicationPoolIdentity, only when using NetworkService: “HTTP Error 503. The service is unavailable.” 数据库关闭时如何防止“503服务不可用” - How to prevent "503 Service Unavailable" when database is down 尝试使用实时监视器时,IIS上的SignalR / EPiServer“ / signalr / hubs?” 404 - SignalR/EPiServer “/signalr/hubs?” 404 on IIS when trying to use Live Monitor 在IIS中托管(503服务不可用) - Hosting in IIS (503 Service Unavailable)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM