coding

IHostedService / BackgroundService IIS 8 issue

Recently I started using the IHostedService interface for some long running jobs in my API service. Of course there are many alternatives for setting up these scheduled jobs.

I followed the instructions at https://docs.microsoft.com/en-us/aspnet/core/fundamentals/host/hosted-services?view=aspnetcore-3.1&tabs=visual-studio, tested locally and everything was running smoothly. My job was getting kicked off every 5 mins and I can see the output in my logs and debug output.

Problems started arising when I deployed my changes to my server (admittedly this API is running on a Windows 2012 R2 server, that is way past it’s life span). This is your typical “it works on my machine” issue.

say it works on my machine one more time - Samuel L Jackson | Meme ...


My background service would only launch once and never run again! Turns out IIS has a feature called Application Initialization that needs to be installed and then adjusted in two area:

Installation

Make sure to install Application Initialization 👇

Application Pool configuration

Open up IIS manager and right click on the application pool, and then choose Advanced settings, set the start mode to AlwaysRunning.

Site configuration

And finally, right click on the website and select Manage Application -> Advanced settings, make sure to set Preload Enabled to True

Wrapping up

Make sure to perform an IISReset after making the changes, if you have any questions please feel free to contact me.

By |July 29th, 2020|Uncategorized|0 Comments

Password hashing and salting explained.

I recently found an article explaining various ways passwords are cracked and the best practices for encrypting and storing passwords.

This is a must read for anyone writing user account systems.

Head over to http://crackstation.net/hashing-security.htm to read the article.

By |March 6th, 2013|Coding|0 Comments

Favorite programming Mistakes

Paul from Smashing Magazine describes some of his favorite programming mistakes:

http://coding.smashingmagazine.com/2011/07/07/my-favorite-programming-mistakes/

By |July 12th, 2011|Coding|0 Comments