简体   繁体   中英

ASP.NET-CORE 2.2 SignalR CORS

I have a problem with ASP.Net Core 2.2 and SignalR. I am using SignalR between asp.net core and Angular. When i am using Asp.net core 2.0, everything work fine. But when i am using asp.net core 2.2 with same code, same classes am getting a cors error.

Warning: The CORS protocol does not allow specifying a wildcard (any) origin and credentials at the same time. Configure the policy by listing individual origins if credentials needs to be supported.

How can i solve this problem?

thanks

When i am using this cors configuration problem is solved. thanks

 services.AddCors(options =>
        {
            options.AddPolicy("CorsPolicy",
                builder => builder
                //.AllowAnyOrigin()
                .AllowAnyMethod()
                .AllowAnyHeader()
                .AllowCredentials()
                .SetIsOriginAllowed((host) => true) //for signalr cors                
                    );
        });

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM