2017-02-21 139 views
0

我有一個簡單的聊天應用程序,在本地正常工作,但SignalR遠程拋出內部服務器錯誤。服務器上的SignalR錯誤500 - asp.net

拋出錯誤的腳本是這樣的:

http://mydomainname.com/signalr/negotiate?clientProtocol=1.5&connectionData ...

這裏是日誌: enter image description here

我已經看過了類似主題的其他答案,但沒有人可以爲我工作。這些是我引用的答案:SignalR Negotiate 404,SignalR Negotiate 404 on Subdomain

下面是客戶端代碼:

$(function() { 
       // Reference the auto-generated proxy for the hub. 
       $.connection.hub.url = 'http://mydomainname.com/signalr'; 
       $.connection.hub.logging = true; 

       var chat = $.connection.chatHub; 

       var name = '<%= username%>' 
       // Create a function that the hub can call back to display messages. 
       chat.client.addNewMessageToPage = function (name, message) { 
        // Add the message to the page. 
        bootbox.alert({ 
         message: "<b>" + name + "</b>: " + message, 
        }); 
       }; 

       chat.client.sendMessage = function (name, message) { 
        // Add the message to the page. 
        $('#discussion').append('<li><strong>' + htmlEncode(name) 
         + '</strong>: ' + $('#message').val() + '</li>'); 
       }; 
       // Start the connection. 
       $.connection.hub.start().done(function() { 
        // code to append message omitted. 
       }); 
}); 

在導航到錯誤鏈接時,我得到一個加密的異常,如下所示:SignalR CryptographicException on AzureWebsites。有沒有解決這個問題的方法?

我使用asp.net 4.5和SignalR 2.我已經嘗試了很多東西,我不知道爲什麼內部服務器錯誤存在。任何幫助將不勝感激。

+0

你需要表現出異常的詳細信息。 '協議錯誤:未知的傳輸.'因爲服務器正在尋找傳輸,所以是正常的。導航到:'http:// mydomainname.com/signalr/negotiate',你應該得到500. – Pawel

+0

@Pawel啊對不起,應該包括這一點。我得到一個加密異常如下所述:http://stackoverflow.com/questions/15393684/signalr-cryptographicexception-on-azurewebsites。但在這種情況下不能確定正確的解決方案。 – GenAsis

+0

您可能沒有配置machineKey。 – Pawel

回答