So you write your nice and fancy service and are all excited to distribute it to your client. You don’t feel like creating an installer for it, that seems like overkill. You just send a zip file with a batch file that calls installutil to register the service. Easy right?
Well, your client calls and complains that get the following error when running installutil aka your batch file:
Exception occurred while initializing the installation:
System.IO.FileLoadException: Could not load file or assembly ‘file:///D:servicesmyservicehost.exe’ or one of its dependencies. Operation is not support. (Exception from HRESULT: 0x80131515).
I am sure you will start scratching your head and immediately blame them missing a dll or maybe the client ran it wrong. Maybe they have it in the wrong directory? Seems feasible, right? Wrong.
It turns out that Windows was protecting them. Windows doesn’t like files from other computers very much, especially not executables. They get a special stay away from me flag.
So, how do I fix this? Easy. Just open the properties dialog on the exe/service you extracted and hit the UNBLOCK button. Now installutil will work great!