ASP.NET Core with IIS - HTTP Verb Not Allowed

前端 未结 7 809
[愿得一人]
[愿得一人] 2020-11-29 02:33

We have an ASP.NET Core 2.0 web site that also presents a couple of simple Web API methods for UI enhancement purposes.

The

相关标签:
7条回答
  • 2020-11-29 03:09

    Whilst removing WebDAV may solve your issue, you may be wondering (like I was), what is WebDAV and what is it used for?

    I found this page which helps explain it:

    https://www.cloudwards.net/what-is-webdav/

    0 讨论(0)
  • 2020-11-29 03:13

    This was what worked for me (netcore 2.0)

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

    Found here: https://www.ryadel.com/en/error-405-methods-not-allowed-asp-net-core-put-delete-requests/

    0 讨论(0)
  • 2020-11-29 03:14

    To prevent WebDav from getting enabled at all, remove or comment the following entry from the ApplicationHost.config:

    <add name="WebDAVModule" />
    

    The entry is located in the modules section.

    Exact location of the config: C:\Windows\System32\inetsrv\config\applicationHost.config

    This worked well for me in .Net Core 2.2

    0 讨论(0)
  • 2020-11-29 03:25

    To prevent WebDav from getting enabled at all, remove the following entry from the ApplicationHost.config:

    <add name="WebDAVModule" /> 
    

    The entry is located in the modules section.

    Exact location of the config:
    C:\Windows\System32\inetsrv\config\applicationHost.config

    This worked well for me in .Net Core 2.1

    0 讨论(0)
  • 2020-11-29 03:26

    For me, I resolved the issue after I noticed I was trying to post to the client domain instead of the API. [facepalm]

    0 讨论(0)
  • 2020-11-29 03:29

    After hours of research and trial and error, the fix seems to be pretty simple. Add a Web.config file to your .NET Core 2.0 application:

    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
        <!-- To customize the asp.net core module uncomment and edit the following section. 
             For more info see https://go.microsoft.com/fwlink/?linkid=838655 -->
        <system.webServer>
            <modules>
                <remove name="WebDAVModule" />
            </modules>
            <handlers>
                <remove name="aspNetCore" />
                <remove name="WebDAV" />
                <!-- I removed the following handlers too, but these
                     can probably be ignored for most installations -->
                <remove name="ExtensionlessUrlHandler-Integrated-4.0" />
                <remove name="OPTIONSVerbHandler" />
                <remove name="TRACEVerbHandler" />
    
                <add name="aspNetCore" 
                     path="*" 
                     verb="*" 
                     modules="AspNetCoreModule" 
                     resourceType="Unspecified" />
            </handlers>
            <aspNetCore processPath="%LAUNCHER_PATH%" 
                        arguments="%LAUNCHER_ARGS%" 
                        stdoutLogEnabled="false"
                        stdoutLogFile=".\logs\stdout" />
        </system.webServer>
    </configuration>
    

    Hope this helps.

    0 讨论(0)
提交回复
热议问题