[HttpException (0x80004005): Failed to Execute URL.]之画蛇添足之痛

时间:2022-03-01 17:17:17

最近很悲惨,发布的一个mvc站点,所有的静态内容,如js、css、图片都不能正常加载,服务器给出的响应是一个如下的异常黄页:

Server Error in '/ua' Application.
Failed to Execute URL.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.HttpException: Failed to Execute URL.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[HttpException (0x80004005): Failed to Execute URL.]
System.Web.Hosting.ISAPIWorkerRequestInProcForIIS6.BeginExecuteUrl(String url, String method, String childHeaders, Boolean sendHeaders, Boolean addUserIndo, IntPtr token, String name, String authType, Byte[] entity, AsyncCallback cb, Object state) +3971606
System.Web.HttpResponse.BeginExecuteUrlForEntireResponse(String pathOverride, NameValueCollection requestHeaders, AsyncCallback cb, Object state) +638
System.Web.DefaultHttpHandler.BeginProcessRequest(HttpContext context, AsyncCallback callback, Object state) +286
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +389
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +371

抛开上面的异常,我先说说我的Beta测试环境,Windows Server 2008 + IIS 7.5 + MVC 3.0 + .NET 4.0 Classic。

在开发环境中,这个用MVC写的应用订购站点一切正常,进入Beta测试环境,按正常流程发布,然后又去模块映射添加了对.net 4.0中aspnet_isapi.dll的映射,然后再去浏览器测试一下站点,糟糕的出现了上面提到的异常。

接下来就是想办法解决,先去Baidu,没有解决,再去Google,看了半天英文资料,多半说是配置的权限,也没发现啥不一样的,还不死心,接着去bing上找,也搞不定,接着耐心去microsoft、cnblogs上找,依然木有结果,断断续续过去了两个周,看到的还是上面的异常,实在是令人沮丧。

回过头再看了看iis6发布mvc站点,查了查iis7.5的映射,发现默认已经有添加通配符*的aspnet_isapi.dll映射,而且还很全面32位、64位都有,接着终于发现了发布时自己画蛇添足的加入的新的aspnet_isapi.dll映射,尝试着把这个映射清除掉,然后会到浏览器,再做了次测试,非常幸运且神奇的发现异常不见了,站点正常了,从此手不酸头也不疼了。

给大家分享一下,同时也期待大家帮忙解释一下,这种对于aspnet_isapi.dll配置了两个通配符映射导致静态文件无法加载的现象。

实在是没文化真可怕!这个iis6里边发布mvc带过来的习惯终究坑哥了!