0

I have an existing deployed web application using Angular and C# Web API 2 which was working before. I didn't know when it started but I recently added a new feature and after that I've been getting the error 405 Method Not Allow for all my PUT actions.

I'm not sure which technology this is related to so I'm tagging all the technology i've used.

Any idea why and how to resolve this?

Thanks

EDIT

I forgot to mention that everything is working fine locally, I only get this error when it is already published to server.

Also that my Angular project is inside the Web API project so I think there'd be no issue with CORS, right?

Jed
  • 1,054
  • 1
  • 15
  • 34
  • 3
    Can you please provide more details about what configuration changes you have done for this new feature development? – Ipsit Gaur Jun 01 '18 at 06:14
  • That's the thing, there are no config changes as far as web.config or IIS is concerned. Just additional c# controllers and Angular module. – Jed Jun 01 '18 at 06:14
  • Have you tried adding [this](https://stackoverflow.com/a/12521656/9766215) in your web.config? – Prachi Jun 01 '18 at 06:14
  • @Prachi which web.config? there are two of them. – Jed Jun 01 '18 at 06:15
  • The one which resides in the folder where your API project is present. The outer most one. – Prachi Jun 01 '18 at 06:17
  • This Might [Help](https://enable-cors.org/server.html) – Vikas Jun 01 '18 at 06:23
  • why you are not try this https://stackoverflow.com/questions/49673496/why-is-my-asp-net-web-api-route-working-with-postman-but-not-working-with-angula/49674035#49674035 – Parth Savadiya Jun 01 '18 at 06:34
  • please share your web.config at the api project ... also the action method with HttpPut and how are you calling it. – Niladri Jun 01 '18 at 06:55
  • Possible duplicate of [MVC-Web API: 405 method not allowed](https://stackoverflow.com/questions/23293782/mvc-web-api-405-method-not-allowed) – TAHA SULTAN TEMURI Jun 01 '18 at 07:11
  • I don't think it's a CORS issue. Please check i've updated my question. Thanks – Jed Jun 03 '18 at 02:37

2 Answers2

0

I had the same problem, there was WebDAV iis module that blocks some http verbs. You can disable it for your web application

https://learn.microsoft.com/en-us/iis/configuration/system.webserver/webdav/

0

I found the solution here:

Asp.NET Web API - 405 - HTTP verb used to access this page is not allowed - how to set handler mappings

Webdav has to be uninstalled, disabling it doesn't work.

Jed
  • 1,054
  • 1
  • 15
  • 34