CORS policy execution failed. followed by Request origin https://app.example.test does not have permission to access the resource. in the server log means the request's Origin is not in the CORS policy. The server still answered, and in this test the endpoint still ran; the response simply had no Access-Control-Allow-Origin header. Add that origin to WithOrigins(...) if it should be allowed.

The two lines are worth turning on when a front end reports a CORS problem, because the second one names the origin exactly as the request sent it.

The error

Both lines are written at Information level by Microsoft.AspNetCore.Cors.Infrastructure.CorsService. The handler logs its own line, which shows it ran for the request from the unlisted origin:

...
info: Microsoft.AspNetCore.Cors.Infrastructure.CorsService[5]
      CORS policy execution failed.
info: Microsoft.AspNetCore.Cors.Infrastructure.CorsService[6]
      Request origin https://app.example.test does not have permission to access the resource.
info: FixLab[0]
      GET /patients handler ran
...

And the response that request got: status 200, the data, and the missing header.

PS> curl.exe -s -i -H "Origin: https://app.example.test" http://127.0.0.1:15630/patients
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Date: Sat, 14 Nov 2026 01:26:52 GMT
Server: Kestrel
Transfer-Encoding: chunked

["Maria Garcia","David Chen"]

With the template's levels (Microsoft.AspNetCore at Warning) the same request printed only the handler's line. This entry under Logging:LogLevel made the CORS lines appear:

...
"Microsoft.AspNetCore.Cors": "Information"
...

Why it happens

The policy allowed one origin:

...
options.AddPolicy("Frontend", policy => policy.WithOrigins("http://localhost:5173"));
...
app.UseCors("Frontend");
...

A request from http://localhost:5173, sent just before, logged CORS policy execution successful. and got Access-Control-Allow-Origin: http://localhost:5173. The request from https://app.example.test did not match, so the middleware added no header and let the request carry on. CORS here decided only which headers went back; it did not stop the endpoint. A POST from the same unlisted origin showed the same thing for a request that would change data: the log printed the two CORS lines and then POST /patients handler ran, and the response was 200 with Patient created. Do not rely on CORS to keep a request from running.

The fix

If the origin is a real front end of yours, list it, copied from the log line. Two near misses were tested against the listed http://localhost:5173: http://localhost:5174 and https://localhost:5173 each logged "does not have permission" and got no header, so the port and the scheme both have to match.

...
options.AddPolicy("Frontend", policy => policy.WithOrigins(
    "http://localhost:5173",
    "https://app.example.test"));
...
PS> curl.exe -s -i -H "Origin: https://app.example.test" http://127.0.0.1:15630/patients
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Date: Sat, 14 Nov 2026 01:26:54 GMT
Server: Kestrel
Access-Control-Allow-Origin: https://app.example.test
Transfer-Encoding: chunked
Vary: Origin

["Maria Garcia","David Chen"]

The log then read CORS policy execution successful. This response also carried Vary: Origin, which the allowed response under the one-origin policy did not. If the origin is not one of yours, the missing header is the right answer and nothing needs fixing.

How it was reproduced

A minimal API made with dotnet new web -f net10.0 on SDK 11.0.100, running on Microsoft.AspNetCore.App 10.0.15 in the Development environment, built and started by a small script, start.ps1, which runs dotnet build -nologo -v q in the project folder and then bin\Debug\net10.0\FixLab.exe --urls http://127.0.0.1:15630. Requests came from curl.exe with an Origin header, not from a browser; app.example.test is a made-up name. The request from the unlisted origin was captured with and without the logging entry. The project file references Microsoft.AspNetCore.Authentication.JwtBearer 10.0.0, unused by this app. FixLab, port 15630, the route /patients, the policy name Frontend, the origin http://localhost:5173 and the patient names are the test's own.

Frequently asked

What does 'Request origin does not have permission to access the resource' mean in ASP.NET Core?
The Origin header of the request is not in the CORS policy. In the test the response came back with status 200 but without Access-Control-Allow-Origin.
Does a failed CORS policy stop the ASP.NET Core endpoint from running?
Not in the test. The endpoint's own log line was written for a GET and a POST from the unlisted origin, and both responses carried the data; only the CORS header was missing.
How do I see CORS log messages in ASP.NET Core?
Add "Microsoft.AspNetCore.Cors": "Information" under Logging:LogLevel in appsettings.json. With the template levels the test printed no CORS line.

More decoded errors in the Fixes category. For what the browser prints for it, see the CORS post about a missing Access-Control-Allow-Origin header.