简体   繁体   中英

WebApi 2 HttpPut, HttpDelete, HttpPost not working-HTTP Error 405.0 - Method Not Allowed

I couldn't access this method:

[HttpPut]
[Route("api/Order/Update/{id}")]
public async Task<IActionResult> UpdateList([FromBody]OrderViewModel order, [FromRoute]int id)
{

}

I get the error:

HTTP Error 405.0 - Method Not Allowed

I solved the problem:

Solution is to uninstall WebDAV module. Control Panel -> Programs and Features -> Turn Windows features on or off -> IIS -> World Wide Web Services -> Common HTTP Feature -> WebDAV Publishing.

yes - that should do the job, however you could just disable webDav in web.config:

<system.webServer>
    <modules>
        <remove name="WebDAVModule" />
    </modules>
    <handlers>
        <remove name="WebDAV" />
    </handlers>
</system.webServer>

cheers

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM