问题
I'm trying to implement comet in my ASP.Net MVC 2.0 project. I'm using WebSync from FrozenMountain. My website is coded in C# 4.0 and ASP.Net 4.0.
The comet code is triggering my MVC controller function with the [HttpPost] attribute (even though the page doesn't refresh or appear to post). Is there a way to determine what is being posted and ignore that route in my global.asax.cs
?
- Please note, I know how to ignore routes with MVC, that is not the issue.
回答1:
The gentlemen at Frozen Mountain helped me solve the problem here
It was hitting one of my MVC controller functions. I had to add this to my global.asax.cs
routes.IgnoreRoute("{*allashx}", new {allashx=@".*\.ashx(/.*)?"});
回答2:
In WebSync 4, you can skip the .ashx handler altogether and just add a route for WebSync directly in Global.asax:
WebSyncServer.AddRoute("...");
来源:https://stackoverflow.com/questions/3241246/asp-net-mvc-comet-websync