Cors for ABP phone-side Invoke API

Source: Internet
Author: User

This question is actually very early consideration, because there is no particular urgency to solve the problem, has been dragged ....

Well, procrastination is not good, all do not bother to do, will eventually force you to a short time to solve the problem ... Implementing the Project

Rewrite an existing WebForm project, need mobile phone and web side data to maintain interoperability, so the first reaction is ABP, can learn, can also complete the task

In the attempt to invoke the API at the time of the Cors cross-domain request problem, before very confused practice cors is not know what, this time also know. Solve the problem and read the document with questions

Http://aspnetboilerplate.com/Pages/Documents/Zero/Startup-Template Abpzero's startup template says how to invoke the API

It's still stuck in cors.

Search for issues in the ABP GitHub search for Cors found

Web API Project:

Install-Package Microsoft.AspNet.WebApi.Cors

Web API Project Module Initialize () Add:

var cors = new EnableCorsAttribute("*", "*", "*");GlobalConfiguration.Configuration.EnableCors(cors);
方法,解决问题,花费了很长的时间,答案往往是简单的要命....

哦对了,有个问题一定要注意
Just made a POST request to http://localhost:6334/api/services/app/tenant/GetTenants with Content-Type="application/json" and Authorization="Bearer your- auth-token ". Request body was just empty {}. Surely, request and response body will be different for different APIs. 在headers里写Authorization的时候一定要是
"Bearer your- auth-token"
 

Cors for ABP phone-side Invoke API

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.