Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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...

like image 593
andresf Avatar asked Jan 28 '13 15:01

andresf


People also ask

How do I fix 1 is not a valid Win32 application?

Re-download the file from the original source where you got it in order to repair the issue. If it does not work, you may need to run the file with the help of using a different version of Windows or even MS-DOS. Sometimes or on rare occasions, Windows may report a bug as "not a valid Win32 application.

Is not a valid Win32 application error code 193?

Error 193: %1 is not a valid Win32 application." This issue may occur if the path of the executable file for the service contains spaces. When Windows starts a service, it parses the path of the service from left to right.

What is 1 is not a valid Win32 application?

The error %1 is not a valid Win32 application generally occurs due to a rogue file named “C:\Program” that exists on the WSUS server. This file seems to cause issues related to the WSUS certificate being properly detected and imported.


2 Answers

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.

like image 174
g bas Avatar answered Sep 20 '22 00:09

g bas


My problem was due to having my service project configured as a Class Library and not Windows Application in the Application pane of the project properties.

Visual Studio 2015 Project Properties Window

like image 22
Guy Lowe Avatar answered Sep 20 '22 00:09

Guy Lowe