SharePoint ASMX Issue - Resolved

By Phill Duffy on Jan 28 2009 | 4 Comments

I came across a pain in the arse issue with SharePoint the other day but now I have managed to get around it, it was an issue where ASMX web services stopped working completely.

The Symptoms when trying to use an ASMX with SharePoint and .Net 3.5

Page: “An error has occurred on the server”

SharePoint Log:“Application error when access /_vti_bin/Lists.asmx, Error=Failed to Execute URL.”

Fiddler: HTTP 401 Unauthorized

I managed to track the issue down to the ordering of the HTTPHandlers in the Web.config, it has added the remove of the ASMX to the bottom!

<httpHandlers>
<remove verb="GET,HEAD,POST" path="*" />
<add verb="GET,HEAD,POST" path="*" type="Microsoft.SharePoint.ApplicationRuntime.SPHttpHandler, Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
<add verb="OPTIONS,PROPFIND,PUT,LOCK,UNLOCK,MOVE,COPY,GETLIB,PROPPATCH,MKCOL,DELETE,(GETSOURCE),(HEADSOURCE),(POSTSOURCE)" path="*" type="Microsoft.SharePoint.ApplicationRuntime.SPHttpHandler, Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
<add verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false" />
<remove verb="*" path="*.asmx" />
</httpHandlers>

Should be

<httpHandlers>
<remove verb="GET,HEAD,POST" path="*" />
<remove verb="*" path="*.asmx" />
<add verb="GET,HEAD,POST" path="*" type="Microsoft.SharePoint.ApplicationRuntime.SPHttpHandler, Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
<add verb="OPTIONS,PROPFIND,PUT,LOCK,UNLOCK,MOVE,COPY,GETLIB,PROPPATCH,MKCOL,DELETE,(GETSOURCE),(HEADSOURCE),(POSTSOURCE)" path="*" type="Microsoft.SharePoint.ApplicationRuntime.SPHttpHandler, Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
<add verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false" />
</httpHandlers>

Post info

Tags:
Categories:

Comments

Bobby F United Kingdom on 2/1/2009 5:02 PM You've changed you have!!! Smile

Looking good Phill, keep it up fella! see you in mid Feb for a beer.... Rob
Mike United States on 7/16/2009 9:21 PM Thanx. Resolved the issue just like that. wtf is up with it breaking in the first place.
Phill Duffy United Kingdom on 7/17/2009 7:59 AM I am glad the post was useful, it just seems that certain implementations which add the .Net 3.5 config to the web.config sticks it in alphabetically - meaning that the 'Adds' do the work first then the 'Remove' comes along and undoes it all!
Philippe Switzerland on 11/6/2009 2:02 PM Thanks very much for sharing this Phill !