Use the net to solve the problem of cross-domain write api

First, we create a project that I was vs 2019 So to create a project like this

Then we can see that the services.AddCors () after we chose startup; add the next chart position

After writing

app.UseCors(builder => builder
.AllowAnyOrigin()
.AllowAnyMethod()
.AllowAnyHeader()

); The following figure

in

 

If you write a document with a net api words have commented

 

This cross-domain success

 

Guess you like

Origin www.cnblogs.com/feng12/p/11069673.html