Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

CORS Error with .NET Core Blazor, ASP.NET Core Web API and SQL Server

$
0
0

When connecting my client with the server, I got this error:

Access to fetch at 'https://localhost:7093/api/authentification/login' from origin 'https://localhost:7022' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.Understand this errorAI
:7093/api/authentification/login:1
Failed to load resource: net::ERR_FAILED

Understand this error I tried fixing the AddCors but it is not solving the error

services.AddCors(options =>         {             options.AddDefaultPolicy(                 policy =>                     {                         policy.WithOrigins("``https://localhost:7022``")                               .AllowAnyHeader()                               .AllowAnyMethod()                               .AllowCredential                     }             )         });app.UseCors();

Viewing all articles
Browse latest Browse all 4839

Trending Articles