我使用 Scott Hanselman 的文章将 MVC3 集成到我的 webforms 应用程序中: http://www.hanselman.com/blog/IntegratingASPNETMVC3IntoExistingUpgradedASPNET4WebFormsApplications.aspx
一切都很好,在我的电脑上本地运行时似乎工作正常。然而,当它被部署来测试以下 URL 时,应用程序会给我一个 404: http://testserver/portal/Services/SEBService.asmx/SEBSearch
如果我只输入: http://testserver/portal/Services/SEBService.asmx它看到了服务
摸不着头脑,我在 global.asax 中尝试了以下修复:
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.IgnoreRoute("{resource}.asmx/{*pathInfo}");
}
唉,还是坏了 :( 任何想法、修复、建议都将不胜感激
最佳答案
修复了这个:
routes.Ignore("{*allasmx}", new { allasmx = @".*\.asmx(/.*)?" });
非常奇怪,它在某些机器上运行,但在其他机器上运行不正常,但包含上述内容后,它在所有机器上运行。
关于c# - 访问服务时在 MVC/webform 应用程序上出现 404,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9465999/