The project was built on an older version of visual studio. All I did to fix this was copy all the source files to a new project under Visual Studio 2013. It works fine now
ASP.Net 4.5 Web Forms routing works for a while then breaks. Why?
-
30-06-2023 - |
题
I'm using the below code in the Global.asax:
protected void Application_Start(object sender, EventArgs e)
{
RegisterRoutes(RouteTable.Routes);
}
protected void RegisterRoutes(RouteCollection routes)
{
routes.MapPageRoute("APIRoute", "{appId}/{key}/{method}/", "~/handler.aspx");
}
At first when I deploy it, and for a couple of minutes after that, the code works for the following sample request:
http://localhost/app1/4/em9tcRqT+BZmdIV0YIa5of6i2Jb9zLpWB6WwtVzy3zU=/testFN/?param=46
At first the request works and returns results, a few minutes later it starts throwing a 404 Not Found error.
I tried adding the following module through web.config but it didn't help
<system.webServer>
<modules>
<add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
</modules>
</system.webServer>
I'm running ASP.net 4.5 on a Windows 2008 R2 Server Any ideas on how to solve this?
解决方案
不隶属于 StackOverflow