SignalR在IE10中抛出此错误:
SCRIPT12008: WebSocket Error: Incorrect HTTP response. Status code 500, Internal Server Error
在Chrome中,所有内容都按预期运行。 我使用的代码:
<!--Reference the SignalR library.-->
<script src="@Url.Content("~/Scripts/jquery.signalR-2.1.2.min.js")"></script>
<!--Reference the autogenerated SignalR hub script-->
<script src="@Url.Content("~/signalr/hubs")"></script>
<!--Add script to update the page and send messages.-->
<script type="text/javascript">
$(function () {
//Declare a proxy to reference the hub.
var chat = $.connection.chatHub;
chat.on('broadcastMessage', function (userId, conversationId, message) {
NewMessages();
});
$.connection.hub.start();
});
</script>
这是枢纽:
public class ChatHub : Hub
{
public void Send(string userId,string conversationId, string message)
{
//Call the broadcastMessage method to update clients.
Clients.All.broadcastMessage(userId, conversationId,message);
}
}
服务器方法&#34;发送&#34;得到正确的,但客户端&#34; broadcastMessage&#34;确实&#39;吨。 我做了一些阅读,IE10支持SignalR。有人知道为什么这不起作用吗?
答案 0 :(得分:0)
chat.client.broadcastMessage = function(userId, conversationId, message)
{
NewMessages();
}