문제

I'm having trouble with the most basic example https://github.com/SignalR/SignalR/wiki/QuickStart-Persistent-Connections. I get "404 on echo/negotiate"

도움이 되었습니까?

해결책

The example is out of date. It's because the default MVC-project calls RegisterRoutes(RouteTable.Routes); You have to move the MapConnection to inside the RegisterRoutes, after the routes.IgnoreRoute("{resource}.axd/{*pathInfo}"; but before any other routes.

I hope this helps

다른 팁

I got the exact same error when trying to implement the basic persistent connection sample, and it took me quite a while to realize that it was due to a version mismatch for Newtonsoft.Json, problem and solution described here:

https://github.com/SignalR/SignalR/issues/195

That is, add a section like:

<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.8.0" newVersion="4.0.8.0" />
</dependentAssembly>

to your web.config.

Don't know why that section was missing for me since as far as I understand it should be added automatically by nuget, perhaps something to do with Visual Studio 11 beta. Anyhow, it was the solution to my problem.

There are two steps :
1. In web.config add or edit rule json

 <dependentAssembly> <assemblyIdentity name="Newtonsoft.Json"
 publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
 <bindingRedirect oldVersion="0.0.0.0-4.0.8.0" newVersion="4.0.8.0" />
 </dependentAssembly>


2. In Global.asax Add new:

RouteTable.Routes.MapConnection<ChatConnection>("negotiate", "/chat");


In method protected void Application_Start(){}

Good luck !

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top