1

I'm working on single page application which consumes WebApi for data manipulation. My site was hosted on Windows Server 2008 R2 (IIS 7.5.7600.16385) and working fine, however after migration to Windows Server 2012 R2 (IIS 8.5.9600.16384) HTTP PATCH VERBS are not working, api call returns with status code 400 "Bad Request". I have tried following code snippet in web.config but got no luck.

<handlers>
      <remove name="WebDAV" />
      <remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" />
      <remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" />
      <remove name="ExtensionlessUrlHandler-Integrated-4.0" />
      <add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" />
      <add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" />
      <add name="ExtensionlessUrlHandler-Integrated-4.0" type="System.Web.Handlers.TransferRequestHandler" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" />
      <add name="Telerik.ReportViewer.axd_*" type="Telerik.ReportViewer.WebForms.HttpHandler, Telerik.ReportViewer.WebForms, Version=9.0.15.225, Culture=neutral, PublicKeyToken=a9d7983dfcc261be" path="Telerik.ReportViewer.axd" verb="*" />
    </handlers>
    <modules runAllManagedModulesForAllRequests="true">
      <remove name="WebDAVModule" />
    </modules>

Googling again and again but got nothing useful, I'm stuck here, Any help would be appreciated.

Ahmad Ahsan
  • 187
  • 3
  • 18
  • http://stackoverflow.com/a/14631068/932833 helped me. Might be worth a shot... – Neil Thompson Mar 09 '15 at 13:33
  • Do you know at what point it fails? e.g. does it hit your request_start method in global.asax? Does it make it as far as your controller? – rdans Mar 09 '15 at 13:34
  • @RyanDansie no idea, but i'm using windows 8.1 (IIS 8.5.9600.16384) on my development machine and everything works here fine. Can you guide me how to check where it fails? Thanks. – Ahmad Ahsan Mar 09 '15 at 13:56
  • on a production server, you would usually need to add logging e.g. write to a file/db/event viewer in various places to find out which parts of the code its getting to. In this case, I would check the controller, global asax events and any auth/action filters you have on your controller. You could also try visual studio remote debugging but its not too easy to get working. – rdans Mar 09 '15 at 14:06

2 Answers2

0

These are the web.config settings I used when I had a similar problem with PUT requests after moving servers.

<remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" />
<remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" />
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
<add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" />
<add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" />
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
rdans
  • 2,179
  • 22
  • 32
  • @RyanDanise Thanks for your response, I use this work around some days ago to fix my oData services issue on development machine. However this didn't work for current issue. Any thing else you may suggest... – Ahmad Ahsan Mar 10 '15 at 11:40
0

When I tried to send API call outside from network, everything was working as expected. Further investigations reveals that network firewall policy was problematic. By mistake production server was blacklisted by NOC team.

Thanks all for your efforts :)

Ahmad Ahsan
  • 187
  • 3
  • 18