2011-04-13 52 views
7

我看到以下异常的某些条目在我的日志,不知道为什么,或者它的发生:无法执行网址 - 有什么想法?

Failed to Execute URL. 
    at 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) 
    at System.Web.HttpResponse.BeginExecuteUrlForEntireResponse(String pathOverride, NameValueCollection requestHeaders, AsyncCallback cb, Object state) 
    at System.Web.DefaultHttpHandler.BeginProcessRequest(HttpContext context, AsyncCallback callback, Object state) 
    at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() 
    at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) 

有没有人碰到这个之前都还是能够说明一些关于它的光?我在IIS7上运行.net 3.5 c#web应用程序。

+0

你检查是否http://stackoverflow.com/questions/3263861/failed-to-load-asmx-file解决你的问题? – 2011-06-06 18:34:48

+0

真的很难猜出为什么你没有更多的信息就得到这个异常。也许这个博客文章可以帮助你:http://geekswithblogs.net/JoostPloegmakers/archive/2006/03/08/71697.aspx – 2011-06-29 19:09:55

+0

你有没有这个运气? – 2012-11-15 07:42:42

回答

2

我刚刚在使用Windows Identity Foundation时遇到了这个问题。通过切换应用程序池以使用Integrated而不是Classic来解决问题。当网址上出现斜线并重定向到登录页面时,它失败了。在url中指定完整页面并不会导致错误。

1

在传统流水线模式下使用WIF时,我遇到了同样的错误。由于我们不能将应用程序更改为集成管道模式,因此我针对David Scott描述的特定场景实施了修复。

在的global.asax.cs:

protected void Application_AuthenticateRequest(object sender, EventArgs e) 
    {   
     // Fix for "Failed to Execute URL" when non-authenticated user 
     // browses to application root 
     if ((User == null) 
     && (string.Compare(Request.Url.AbsolutePath.TrimEnd('/'), 
     Request.ApplicationPath, true) == 0)) 
     { 
     Response.Redirect(Request.ApplicationPath + "/Default.aspx"); 
     HttpContext.Current.ApplicationInstance.CompleteRequest(); 
     } 
    } 

认证尝试之前,Application_AuthenticateRequest是带一个空的用户对象。只有在这种情况下,代码才会重定向到/Default.aspx(我的应用程序是Asp.Net Web表单)。这为我们解决了这个问题。