How To Resolve HttpException (0x80004005): Failed to Execute URL
Summary: Ambuj Nautiyal, a Microsoft Premier Field Engineer based in Canada, walks us through a solution for the circumstance where your .NET application(s) throw the error HttpException: Failed to Execute URL.
I was recently working with one of my customers and when they deployed a .NET application into production one of the settings on IIS was preventing the application from operating. The customer’s operations team had spent considerable time trying to resolve the exception, which was particularly baffling as the same application was working absolutely fine in the test environment. The exception we were running into is Failed to Execute URL. Somehow this exception does not emit any IIS error information on the server. Typically, but not always, you would see this exception in conjunction with an environment residing behind ADFS.
More specifically, the exception appeared as follows:
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.
And here’s the associated 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) +4040320
System.Web.HttpResponse.BeginExecuteUrlForEntireResponse(String pathOverride, NameValueCollection requestHeaders, AsyncCallback cb, Object state) +590
System.Web.DefaultHttpHandler.BeginProcessRequest(HttpContext context, AsyncCallback callback, Object state) +286
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +375
Looking at the exception details -- System.Web.HttpException: Failed to Execute URL -- it indicates that URL authorization that is failing. You can check out details of URL authorization in this article on ASP.NET Authorization.
Resolving this problem requires you to make sure you deny Anonymous Users in your .NET authorization rules for the application, as follows:
As mentioned in the article on ASP.NET Authorization, this can be controlled by the developer of the application, and by using the <authorization> element in web.config file, as follows:
<deny users="?" />
Hope this will be of help to you and saves you some troubleshooting time.