Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/325.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 访问服务时,MVC/webform应用程序上的404_C#_Web Services_Asp.net Mvc 3_Routing - Fatal编程技术网

C# 访问服务时,MVC/webform应用程序上的404

C# 访问服务时,MVC/webform应用程序上的404,c#,web-services,asp.net-mvc-3,routing,C#,Web Services,Asp.net Mvc 3,Routing,我使用Scott Hanselmans的文章将MVC3集成到我的webforms应用程序中: 所有方法都很好,在我的pc上本地运行时似乎工作正常。但是,当这被部署到测试中时,以下URL会破坏应用程序,给我一个404: 如果我只加上: 它看到了服务 我挠头尝试了global.asax中的以下修复: public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.

我使用Scott Hanselmans的文章将MVC3集成到我的webforms应用程序中:

所有方法都很好,在我的pc上本地运行时似乎工作正常。但是,当这被部署到测试中时,以下URL会破坏应用程序,给我一个404:

如果我只加上: 它看到了服务

我挠头尝试了global.asax中的以下修复:

public static void RegisterRoutes(RouteCollection routes)
{
        routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
        routes.IgnoreRoute("{resource}.asmx/{*pathInfo}");
}
唉,还是坏了:(任何想法、修复、建议都将不胜感激。

用以下方法修复:

routes.Ignore("{*allasmx}", new { allasmx = @".*\.asmx(/.*)?" });

非常奇怪的是,它在某些机器上工作,而不是在其他机器上工作,但在包含上述内容的情况下,它可以在所有机器上工作。

我必须用以下内容更新我的web.config

<system.webServer>
    <handlers>
      <remove name="asmx" />

      <add name="asmx" verb="*" path="*.asmx" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    </handlers>
</system.webServer>