.netcore3.1 cross-domain settings

Original: .netcore3.1 cross-domain settings

1, all of the terminals can be called, as follows:

Copy the code
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
    // Preceding code ommitted.
    app.UseRouting();

    app.UseCors();

    app.UseEndpoints(endpoints =>
    {
        endpoints.MapControllers();
    });

    // Following code ommited.
}
Copy the code

By the end point routing, CORS middleware must be configured to be performed between calls to UseRouting and UseEndpoints of. Middleware is not configured correctly will lead to stop functioning properly.

 

Guess you like

Origin www.cnblogs.com/lonelyxmas/p/12242573.html