The server sent a response which SharePoint Designer could not parse

by michel 17. December 2008 08:13

At this moment I'm building different kind of webparts for MOSS 2007. Some of these webparts are using the nice new fancy .Net 3.5 stuff. Because webparts are running in the SharePoint context you need to upgrade SharePoint to .Net .5 to get it to work.

Thanks to Jan Tielen I found an easy way to do this, hereby the 6-step tutorial:

  • Start Visual Studio 2008.
  • Create a new dummy ASP.NET Web Application Project, and make sure you target the .NET Framework 2.0 (upper right dropdown of the New Project dialog). The name of this project is not important; you won’t need it anymore when we’re done.
  • Copy the web.config of your SharePoint 2007 site, into the dummy Web Application project in Visual Studio.
  • Open the Project Properties in Visual Studio (right click on the Project node in the Solution Explorer, and choose Properties; or in the Project menu, select WebApplicationX Properties).
  • Select .NET Framework 3.5 in the Target Framework dropdown (select Yes in the confirmation dialog).
  • Copy the web.config from the Web Application Project back to SharePoint.

After doing this I did some testing inside SharePoint. Everything seemed to work. Until the next day...

The day after I needed to some things with my 'favorite tool' "SharePoint designer". I connected to my test-machine and try to open a aspx-file inside the designer (the application tree was shown as normal). I got the following error:

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.

Because I just upgraded the to .NET 3.5 , I knew the cause would be somewhere in the web.config file. After some digging  found out that inside the httpHandlers something went wrong:

<httpHandlers>
    <remove verb="GET,HEAD,POST" path="*"/>
    <add verb="GET,HEAD,POST" path="*" type="Microsoft.SharePoint.ApplicationRuntime.SPHttpHandler, ....."/>
    <add verb="OPTIONS,PROPFIND,PUT,LOCK,UNLOCK,MOVE,COPY,GETLIB,PROPPATCH,MKCOL,DELETE,(GETSOURCE),....."/>
    <add verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.Http....."/>
    <add verb="*" path="_vti_bin/ReportServer" type="Microsoft.ReportingServices.SharePoint.Soap.RSP....."/>
    <add verb="*" path="Reserved.ReportViewerWebPart.axd" type="Microsoft.ReportingServices.SharePoi....."/>
    <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFacto....."/>
    <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHa....."/>
    <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, ....."/>
    <remove verb="*" path="*.asmx"/>
</httpHandlers>

 

The <remove verb="*" path="*.asmx"/> key is removing the ScriptHandlerFactory (3 lines above) registration.

Solving is easy, move the <remove verb="*" path="*.asmx"/> key up to the top just below the <remove verb="GET,HEAD,POST" path="*"/> key. In this example your httpHandler section would look like this:

<httpHandlers>
    <remove verb="GET,HEAD,POST" path="*"/>
    <remove verb="*" path="*.asmx"/>            
    <add verb="GET,HEAD,POST" path="*" type="Microsoft.SharePoint.ApplicationRuntime.SPHttpHandler,....."/> 
<
add verb="OPTIONS,PROPFIND,PUT,LOCK,UNLOCK,MOVE,COPY,GETLIB,PROPPATCH,MKCOL,DELETE,(GETSOURCE)....."/> <add verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.Htt....."/> <add verb="*" path="_vti_bin/ReportServer" type="Microsoft.ReportingServices.SharePoint.Soap.RS....."/> <add verb="*" path="Reserved.ReportViewerWebPart.axd" type="Microsoft.ReportingServices.SharePo....."/> <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFact....."/> <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptH....."/> <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler,....."/>
</
httpHandlers>

 

Making changes in the Web.config will cause the application pool to restart, don't do this in a live productional system during working hours, restartig SharePoint takes ages :)

Tags: , , , ,

.Net | Debug | SharePoint

About the author

Michel TolMy name is Michel Tol. I'm a developer specialized in .NET technologies. Mainly focussing on SharePoint Technologies and web development. I am Certified Technology Specialist for MOSS 2007 -  Configuration, .Net Framework 2.0 - Web applications and Biztalk Server 2006 - Custom Applications.

View Michel Tol's profile on LinkedIn

  

E-mail me Send mail

Page List