簡體   English   中英

SignalR服務404集線器

[英]SignalR Service 404 Hub

我在一個簡單的Windows Service應用程序中安裝了SignalR主機。

protected override void OnStart(string[] args)
{
    const string url = "https://localhost:8080";

    AppDomain.CurrentDomain.Load(typeof(MyHub).Assembly.FullName);

    using (WebApp.Start<Startup>(url))
    {
        Log(string.Format("Device Hub started on {0}", url));
    }
}

其中MyHub是引用的控制台項目中我的Hub類的名稱,而Startup只是

public class Startup
{
    public void Configuration(IAppBuilder app)
    {
        app.MapSignalR();
        app.UseCors(CorsOptions.AllowAll);
    }
}

SignalR似乎已啟動,但我在https://localhost:8080/signalr/hubs收到404錯誤。 我認為它可能無法識別該中心,但是我不太清楚如何注冊它。 有什么建議么?

**這個精確的代碼在運行控制台應用程序時有效,但是現在似乎無法通過服務訪問它**

您可能需要檢查以下內容:

http://allen-conway-dotnet.blogspot.ch/2012/02/applying-and-using-ssl-certificate-with.html

它不像http或https + IIS那樣簡單。

UPDATE

好的,我更仔細地閱讀了它,我認為您有一個主要錯誤,您正在using(...)塊內調用Start方法,這意味着您立即關閉了主機( OnStart方法退出)。 刪除您的using(...)塊,它應該可以工作(我使用http測試了它)。

同樣,考慮到在項目中引用了MyHub的事實,根本不需要AppDomain東西。

如何配置: 鏈接出於好奇:集線器僅適用於HTTP嗎? (沒有SSL?)

編輯:將URL從https://localhost:8080更改為https://127.0.0.1:8080然后重試。

像這樣將連接字符串上的端口更改為443

const string url = "https://localhost:443";

還是不使用ssl

 const string url = "http://localhost:8080";

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM