none
ASP.NET CORE 2.2 SignalR CORS Problem RRS feed

  • Question

  • Hello Everyone,

    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."

    When i am using this cors configuraiton, problem is solved

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





    Tuesday, January 22, 2019 7:24 AM

All replies

  • Hi ertgamgam,

    Thanks for your sharing.

    Since your question is more related to ASP.NET forum, I will move it to OFF-TOPIC forum.

    Best Regards,

    Wendy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, January 31, 2019 8:40 AM