.NET Web in Azure App Service not working Cors

Petr Kasnal 26 Reputation points
2023-10-18T15:41:02.87+00:00

Hey. Hey,

I'm creating an api in .NET and I have set up cors using the following code.

builder.Services.AddCors(options =>
{
    options.AddPolicy("Test", policy =>
    {
        policy.WithOrigins("https://dataintegrationswagger.blob.core.windows.net/");
        policy.WithOrigins("https://deepappfrontend.z6.web.core.windows.net/");
    });
});
app.UseCors("Test");

But when I upload the app to App Service, the cors setting from the app does not work. When I set it directly in Azure, it works, but I don't want that at all.

What to do?

Thanks

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,933 questions
Developer technologies .NET Other
{count} vote

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.