且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

无法读取未定义SignalR集线器的属性'chatHub'

更新时间:2023-02-24 19:59:33

可能在文档的<HEAD>中缺少此行:

Probably missing this line in the <HEAD> of your document:

<script src="/signalr/hubs" type="text/javascript"></script>

检查您是否也有

 <script src="/Scripts/jquery.signalR-1.0.0.js"></script>

然后使用Fiddler或Chrome开发者工具检查两个文件是否都已加载,并且/hubs文件是否包含您希望集线器定义包含的内容.

And check, using Fiddler or Chrome Developer Tools that both files are loading and that the /hubs file contains what you expect it to contain in terms of hub definitions.