aspnetcore 3.1.2 windows hosting bundle caused 503 services unavailable

Today NET Core 3.1.200 SDK - March 16, 2020 was installed on my development and production boxes. With a new release, I tend to also install the Windows hosting bundle associated with each release, and in this case, it was ASP.NET Core Runtime 3.1.2 However, on installing it, the next request to the website showed a 503 Service Unavailable error: Debugging the w3 process in Visual Studio showed this error: Unhandled exception at 0x53226EE9 (aspnetcorev2.dll)...

Continue Reading

localhost HTTPS subdomains with a Kestrel SSL certificate

When you build ASP.NET Core websites locally, you can view your local site under HTTPS/SSL, go read this article by Scott Hanselman for more information. For the most part, this works great out of the box. However, I am building a multi-tenant application as in I make use of subdomains such as https://www.mywebsite.com and https://customer1.mywebsite.com. So naturally, when I develop locally I want to visit https://www.localhost:5001/ and https://customer1.localhost:5001/ Now you can do this out of...

Continue Reading

3008 A configuration error has occurred

A static HTML website I look after is hosted on a Windows Server 2012R2 instance running IIS, it makes use of a web.config file as it has some settings that allow this site to be served from behind an Amazon Web Services Elastic Load Balancer. Today it kept crashing with the thousands of these events in event viewer: Event code: 3008 Event message: A configuration error has occurred. Event time: 05/03/2020 09:15:49 Event time (UTC):...

Continue Reading

Call UseSession after UseRouting and before UseEndpoints

Today, I fixed a bug where session cookies were not being persisted in an ASP.Net Core Razor Pages application. The answer was in the documentation. To quote that page: The order of middleware is important. Call UseSession after UseRouting and before UseEndpoints So my code which did work in the past, but probably before endpoint routing was introduced was this: app.UseSession(); app.UseRouting(); app.UseEndpoints(endpoints => { endpoints.MapControllers(); endpoints.MapRazorPages(); }); And the fix was to move UseSession...

Continue Reading

Restart Omnisharp process within Visual Studio Code

Another quick one for today, Every now and again my intellisense gets confused in Visual Studio Code displaying errors and warnings that should not exist. The fix for this is to restart the Omnisharp process. So first off get the commmand pallette up: Ctrl+Shift+P Then type: >omnisharp:restart omnisharp Everything should then go back to normal. Success 🎉

Continue Reading