ABP PUT, delete request error 405.0-method not allowed because invalid method (HTTP verb) was used to raise client error No ' Access-control-allow-origin ' header is present On the requested resource

Source: Internet
Author: User

Please check if it is a cross-domain configuration issue, please refer to the blog:http://www.cnblogs.com/donaldtdz/p/7882225.html

First, the problem description

ABP Angular front-end deployment, query, add no problem, but update and delete will report a cross-domain problem error, the details are as follows:

PUT http://localhost:8060/api/services/app/User/Update 405 (Method not allowed)

Users:1 Failed to load http://localhost:8060/api/services/app/User/Update:No ' Access-control-allow-origin ' header is Present on the requested resource. Origin ' http://localhost:4200 ' is therefore not allowed access. The response had HTTP status code 405.

Second, the problem analysis and diagnosis

First check the cross-domain configuration is not a problem, query data and new data requests are also no problem, only in the modification and deletion of data. By understanding the ABP Web API request header settings, the query is a GET request, new is a POST request, and the modification is a put request, delete is a delete request, and the IIS service usually supports get and post requests, As a result of this analysis, it is possible that IIS does not support put and delete predicate requests.

The new add verb put and delete are added to IIS through Baidu again. Click on deploy Apps--Come Out program map –> Aspnetcore (because I'm deploying a. Net Core program, so select the Aspnetcoremodule module)

Double-click Open

By checking that the Aspnetcore itself is supporting all predicates, it is certainly related to this predicate, but requires more detailed error information.

Since good information is cross-domain, we first ruled out the impact of cross-domain factors, and now we see that cross-domain error messages are probably an illusion, and we debug the Web API through swagger.

To configure authorization tokens for debugging, please refer to the blog:http://www.cnblogs.com/donaldtdz/p/7892865.html

Test the interface first:/api/services/app/user/getall

Test Result: by 200

Re-Test interface:/api/services/app/user/delete

Test results:

HTTP Error 405.0-method not allowed

The page you are looking for cannot be displayed because an invalid method (HTTP verb) is used.

Open the response body with a saved browser as follows:

Looking at the detailed error message, we started with the inference is no problem, and finally tried a lot of methods, the core of the problem is the module Webdavmodule

Third, the solution

Enable or disable Windows features –> Internet information Services to turn off WebDAV publishing

Verify: Modify User success

ABP PUT, delete request error 405.0-method not allowed because the invalid method (HTTP verb) was used to raise a client error No ' Access-control-allow-origin ' header is pres ENT on the requested resource

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.