13
Vote

3.5 Config & Ajax.Config httpHandlers added in the wrong order

description

<remove verb="" path=".asmx" /> gets added after <add verb="GET,HEAD" path="ScriptResource.axd" <add verb="" path=".asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
 
This Means the .asmx pages do not work on the sharepoint application affter adding the feature. This also prevent you edit the site using sharepoint designer because /_vti_bin/usergroup.asmx will give a 401.
 
Before features
 
<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="Telerik.RadUploadProgressHandler.ashx" type="Telerik.Web.UI.RadUploadProgressHandler, Telerik.Web.UI, Version=2008.1.515.35, Culture=neutral, PublicKeyToken=121fae78165ba3d4" />
  <add verb="*" path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource, Telerik.Web.UI, Version=2008.1.515.35, Culture=neutral, PublicKeyToken=121fae78165ba3d4" validate="false" />
</httpHandlers>
 
After features
 
<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" />
  <add verb="*" path="Telerik.RadUploadProgressHandler.ashx" type="Telerik.Web.UI.RadUploadProgressHandler, Telerik.Web.UI, Version=2008.1.515.35, Culture=neutral, PublicKeyToken=121fae78165ba3d4" />
  <add verb="*" path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource, Telerik.Web.UI, Version=2008.1.515.35, Culture=neutral, PublicKeyToken=121fae78165ba3d4" validate="false" />
  <remove verb="*" path="*.asmx" /> </httpHandlers>

comments

Tezler wrote Sep 3, 2008 at 4:30 PM

This problem does cause issues. The luxeries and benefits gained by using solutions and features are lost if manual editing is required. While appreciating it gets you 95% of the way there having to manually edit the web.config file after deployment destroys the feature.

chipso4 wrote Sep 30, 2008 at 8:01 PM

This issue also wreaks havoc with sharepoint designer. I keeped getting a weird error everytime I tried to connect (The server sent a response which SharePoint Designer could not parse. If you are trying to connect to a Windows SharePoint Services server, check with the server's administrator to make sure Windows SharePoint Services is installed properly.) Helpful feature but lost a lot of time debugging.

wrote Sep 30, 2008 at 8:02 PM

wrote Oct 31, 2008 at 6:45 PM

wrote Nov 8, 2008 at 5:14 PM

wrote Dec 3, 2008 at 5:35 PM

bbattah0 wrote Dec 4, 2008 at 9:23 PM

This issue can be resolved by modifying the code of FeatureReciever.cs as follows:
        //**********************************
        // Modified Here in order to fix a bug where the "remove" tag was being added to the end of the section.
        // From: "configuration/system.web/httpHandlers",
        // To: "/configuration/system.web/httpHandlers",

        // It turns out that the MS implementation of the webconfig modification class puts mods into an alphabetically sorted list (one for each type)
        // and ignores the Sequence number.
        // (Actually it's not ignored but seems to be used to determine a winner in case of a modification naming collision.)
        // The sorting is done on the full string of (path + "/" + name)
        // What this means for us is that as long as the "/" character sorts in front of the "a" character then this hack will cause the implementation to 
        // add our modification after before the following "add" modifications.
        AddNodeValue(
        "remove[@path='*.asmx']",
        "/configuration/system.web/httpHandlers",
        @"<remove verb=""*"" path=""*.asmx""/> "
        );
        //***********************************

wrote Dec 18, 2008 at 2:40 AM

wrote Jan 7, 2009 at 10:00 AM

wrote Apr 15, 2009 at 5:27 PM

wrote May 6, 2009 at 1:39 PM

wrote Jul 30, 2010 at 1:16 PM

Mr_T wrote Jul 30, 2010 at 1:17 PM

I tried the fix from bbattah0...didn't work

wrote Feb 14, 2013 at 7:55 PM