Search code examples
windowsservice

Error 193: '%1 is not a valid Win32 application on Windows Server 2003


I would like to get some help, I'm getting this error when trying to start a windows service and it's driving me crazy. The details are:

  • I've got a Windows Service developed on VB.NET (VS 2012), it's compiled for a x86 machine.
  • I used InstallUtil and the "SC CREATE" command to install the service on the customer's server (running under Windows Server 2003).
  • When I try to start the service, I get the following error message: "Could not start the service on Local Computer. Error 193: 0xc1"
  • I looked the Event Viewer for some clues, but I couldn't find any very useful info: in the "Application" tab there are no records logged by the service so I assume it's not even running a single line of code. In the "System" tab there are records logged by the Service Control Manager with the following error message: "%1 is not a valid Win32 application."

I did a long research on the web and the only solution provided is checking Windows Registry to find the ImagePath for the service and add some quotes at the beginning and end of the path. This is supposed to solve the problem but it's not working in my case. I have modified several times the ImagePath (I added and removed the quotes, tried with double a triple quotes) but I'm not getting any positive results.

Could someone help me with this? Thanks in advance...


Solution

  • I think that there is a combatibility problem with .net framework that you use and windows server 2003.Do you use .net 4.5? Windows server 2003 can't run applications which target net framework 4.5.

    http://www.microsoft.com/visualstudio/eng/products/compatibility

    So you could change your target framework to 4.0.