404:signalr/hubs for signalR chat application

爱⌒轻易说出口 提交于 2019-12-11 11:08:40

问题


I am trying to create a chat application using signalR using VS2012 web in a website. But its showing me error like this:

Failed to load resource: the server responded with a status of 404 (Not Found)   
http://localhost:50780/WebApplication1/WebApplication1/signalr/hubs
Uncaught TypeError: Cannot read property 'client' of undefined

I have added RouteTable.Routes.MapHubs(); to Global.asax But why should its showing me this error when its opening for other's system.


回答1:


On the page where you're including signalr/hubs:

Change your script tag to look like this:

<script src="~/signalr/hubs"></script>

@drch's answer is also correct (if you're making that mistake) but the more common issue I see is people just doing "signalr/hubs" in their script tag and then the hubs url is then incorrect (in some circumstances).

Ultimately the hubs url resides off of the SignalR endpoint so doing a "~/signalr/hubs" makes the path app relative which should ensure that it retrieves the hubs.js from the correct url.




回答2:


I know, that I'm late, but for smbd who will finding answers: I've resolved the problem by registrate .Net frame work to IIS. Do next steps into console (Win+R):

cd %windir%\Microsoft.NET\Framework\v4.0.30319
aspnet_regiis.exe –i

Source



来源:https://stackoverflow.com/questions/16235175/404signalr-hubs-for-signalr-chat-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!