I have a program (I created) and I want to start it on the server when the webpage loads.
Here is the code I have
public partial class _Default : S
It sounds like the application you're trying to run has a user interface. If you're intention is to run this on the server using the ASP.NET application pool account, you will have fewer problems if you design the application as a console app, and guard all access to external resources, like your HMI device, with logged exceptions.