{"id":225,"date":"2020-09-29T14:09:39","date_gmt":"2020-09-29T14:09:39","guid":{"rendered":"http:\/\/tutorials.moedesign.de\/blog\/?p=225"},"modified":"2020-09-29T14:09:39","modified_gmt":"2020-09-29T14:09:39","slug":"error-405-methods-not-allowed-in-asp-net-core-application","status":"publish","type":"post","link":"http:\/\/tutorials.moedesign.de\/blog\/error-405-methods-not-allowed-in-asp-net-core-application\/","title":{"rendered":"Error 405 &#8211; Methods not allowed in Asp.Net Core application"},"content":{"rendered":"<p>I developed an Api in <strong>Asp.Net Core Web Api<\/strong>. While testing it on my local machine verything works fine. When I deployed it to my Ionos Managed Windows Hosting I got a <strong>405 Http Error<\/strong> on some Endpoints. Analyzing this behaviour showed me that only controller methods with <strong>PUT and DELETE<\/strong> annotations throwed the error.<\/p>\n<p>The problem seems to be the WebDav Module of IIS blocking PUT and DELETE requests by default.<\/p>\n<p><strong>Solution:<\/strong> Remove WebDav in the web.config file.<\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\n\n&lt;system.webServer&gt;\n&lt;handlers&gt;\n&lt;remove name=&quot;WebDAV&quot; \/&gt;\n&lt;add name=&quot;aspNetCore&quot; path=&quot;*&quot; verb=&quot;*&quot; modules=&quot;AspNetCoreModuleV2&quot; resourceType=&quot;Unspecified&quot; \/&gt;\n&lt;\/handlers&gt;\n&lt;modules&gt;\n&lt;remove name=&quot;WebDAVModule&quot; \/&gt;\n&lt;\/modules&gt;\n&lt;\/system.webServer&gt;\n\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>I developed an Api in Asp.Net Core Web Api. While testing it on my local machine verything works fine. When I deployed it to my Ionos Managed Windows Hosting I got a 405 Http Error on some Endpoints. Analyzing this behaviour showed me that only controller methods with PUT and DELETE annotations throwed the error. &hellip; <\/p>\n<p class=\"link-more\"><a href=\"http:\/\/tutorials.moedesign.de\/blog\/error-405-methods-not-allowed-in-asp-net-core-application\/\" class=\"more-link\"><span class=\"screen-reader-text\">\u201eError 405 &#8211; Methods not allowed in Asp.Net Core application\u201c <\/span>weiterlesen<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,3,4,6,7],"tags":[],"class_list":["post-225","post","type-post","status-publish","format-standard","hentry","category-asp-net-core-mvc","category-aspnetcorewebapi","category-asp-net-mvc","category-csharp-2","category-iis"],"_links":{"self":[{"href":"http:\/\/tutorials.moedesign.de\/blog\/wp-json\/wp\/v2\/posts\/225","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/tutorials.moedesign.de\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/tutorials.moedesign.de\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/tutorials.moedesign.de\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/tutorials.moedesign.de\/blog\/wp-json\/wp\/v2\/comments?post=225"}],"version-history":[{"count":0,"href":"http:\/\/tutorials.moedesign.de\/blog\/wp-json\/wp\/v2\/posts\/225\/revisions"}],"wp:attachment":[{"href":"http:\/\/tutorials.moedesign.de\/blog\/wp-json\/wp\/v2\/media?parent=225"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/tutorials.moedesign.de\/blog\/wp-json\/wp\/v2\/categories?post=225"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/tutorials.moedesign.de\/blog\/wp-json\/wp\/v2\/tags?post=225"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}