"The simplest, I small white, big God do not spray"
One: Create Web API service side
① creating a Web API Project
② adds the following paragraphs to the Web. config for this API project:
<customHeaders>
<add name= "Access-control-allow-origin" value= "*"/>
<add name= "Access-control-allow-methods" value= "GET, POST, PUT, DELETE, OPTIONS"/>
<add name= "Access-control-allow-headers" value= "Content-type,x-requested-with"/>
<add name= "Access-control-request-methods" value= "GET, POST, PUT, DELETE, OPTIONS"/>
</customHeaders>
Under
③ Create an empty API controller under:
④ because only tests, create simple as:
The above Web API-side creation for testing is complete
Two: Create a Web MVC client
① solution creates an empty MVC:
② also creates an empty MVC controller:
③ Add the following code to index.cshtml
Completion of the above MVC client
Three: Run the test
① Run tests need to maintain the operational state of the API server:
② after running is this no tube
③ manually entering the MVC client address
Run successfully
Web API Local Testing