I created a Blazor Server webapp and published it from Visual Studio using right click on the project - publish. I am publishing to a local folder, amongst others the output includes MyProject.exe
Running that works fine:
info: Microsoft.Hosting.Lifetime[0]
Now listening on: http://localhost:5000
info: Microsoft.Hosting.Lifetime[0]
Now listening on: https://localhost:5001
info: Microsoft.Hosting.Lifetime[0]
Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
Hosting environment: Production
However I can not access my webapp on https://localhost:5001. Firefox gives me the error code SEC_ERROR_INADEQUATE_KEY_USAGE. There is no option to ignore it. Accessing it using Chrome just gives me HTTP ERROR 500. In the console where I started MyProject.exe I can find this error:
fail: Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware[1]
An unhandled exception has occurred while executing the request.
System.InvalidOperationException: Cannot find the fallback endpoint specified by route values: { page: /_Host, area: }.
at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.DynamicPageEndpointMatcherPolicy.ApplyAsync(HttpContext httpContext, CandidateSet candidates)
at Microsoft.AspNetCore.Routing.Matching.DfaMatcher.SelectEndpointWithPoliciesAsync(HttpContext httpContext, IEndpointSelectorPolicy[] policies, CandidateSet candidateSet)
at Microsoft.AspNetCore.Routing.EndpointRoutingMiddleware.<Invoke>g__AwaitMatch|8_1(EndpointRoutingMiddleware middleware, HttpContext httpContext, Task matchTask)
at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.<Invoke>g__Awaited|6_0(ExceptionHandlerMiddleware middleware, HttpContext context, Task task)
fail: Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware[3]
Can anyone help me with this? And yes, it's a private application and shall run locally on localhost. When I run my webapp from Visual Studio, everything works fine.
I got the SEC_ERROR_INADEQUATE_KEY_USAGE error too when trying to debug my .Net 6 app with Visual Studio and Firefox. It worked fine on other browsers, just not Firefox. I found the answer on Super User here. Your question mentions that you can debug without issues, but perhaps this solution will still work for you.
Visual Studio generates its own CA and installs it into the Windows Certificate store for web development. You can configure Firefox to import CAs from the Windows Certificate Store by enabling the ImportEnterpriseRoots setting in Firefox.
Do the following to enable use of the Windows Certificate Store by Firefox:
I had a similar problem with the Angular proxy with an aspnetcore back end. The solution for me was to delete the certificate and key used by the proxy located in:
%AppData%\ASP.NET\https
The proxy then regenerates a new certificate and can carry on as normal.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With