How to Fix Error 405 – Method Not Allowed in ASP.NET Core

Some of our users sometimes experience this issue when publishing Single-Page Application into production upon a Windows Server. The following is error message that you see:

Error 405 – Methods not Allowed

Solution for the Problem

To do this open up your web.config file. There are 2 web.config files in your project – The one you want to open is the one inside the wwwroot folder.

Inside the web.config add the following 3 lines inside the already existing system.webServer node:

<system.webServer>
  <modules runAllManagedModulesForAllRequests="false">
    <remove name="WebDAVModule" />
  </modules>
</system.webServer>

Now just save your file and publish changes to your live site.

Note that once you apply this setting, WebDAV will no longer work.

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *