Skip to main content
 首页 » 编程设计

c#之网址路由 asp.net 4 webforms之不工作

2024年01月12日32wayfarer

我是第一次在我的开发机器上设置测试路线。

我遇到的问题是在尝试测试时出现 404 错误。
例如http://domain.local/about

我正在使用 Scott Guthrie 的这篇文章

Win 7 64位
Visual Studio 2010/asp.net webforms 4.
iis7.5,网站在应用程序池中使用集成托管管道。

我的 global.asax 中有以下路由

protected void Application_Start(object sender, EventArgs e) 
{ 
    RegisterRoutes(RouteTable.Routes); 
} 
 
private void RegisterRoutes(RouteCollection routes) 
{ 
    routes.Clear(); 
    routes.MapPageRoute("about route", "about", "~/about.aspx"); 
} 

代码确实被命中了。

我也试过使用 aspnet_regiis.exe -i 重新注册 asp

有什么建议吗?

请您参考如下方法:

我没有发现您的代码有任何问题。确保重新启动 ASP.NET 开发服务器。