A collegue of mine reported that he experienced difficulties deploying af .net 4.0 windows service. The installation process went just fine, but when trying to start the service he recieved the following error almost instantly:
Trying to get a grip on the cause of the error, the OnStart event of the service was left blank – and still the service failed to start.
Usuallly when a service fails to start and return error 1053 almost instantly, it is caused by a reference to an assemmbly which is not properly loaded. In this case only references to .net assemblies were created. Having installed the .net framework 4.0 should make you think that you are homefree – but that’s not necessarily the case. The secret lies in which target framework you choose to build your service on:
In this case the .NET framework 4 was choosen, because some of the assmeblies used, were not included in the default “.NET Framework 4 Client Profile”. On the server where the service was deployed it turned out, that only the .net framework 4 client profile was installed. Now the solution was simple – we just had to install the extended version of the .Net framework.