ServiceBase service error 193:0xc1 on Windows XP
Solution 1
You must have compiled your exe either for .Net 4.5 or for 64-bit architecture (or both). This is the explanation of error code you run into from WinError.h:
// %1 is not a valid Win32 application.
//
#define ERROR_BAD_EXE_FORMAT 193L
Make sure you have compiled it for x86 platform or Any CPU, and whatever version of .Net Framework you compiled against is installed on the machine.
Solution 2
I found this after googling the windows service error number: *Generally the error message means that the service manager couldn't find the exact .exe path to run the service. Sometimes, the service is installed from a directory with multiple words for the directory name. So the registry path to the service needs to be placed with double quotes.
Click ‘Start’ and type ‘services.msc’ and hit Enter Check for the multimedia class scheduler and audio endpoint builder service. Check for the path under "path to executable:" for both the services. Make a note of the same. Also make a note of the service name for both the services. The services are as follows:
AudioEndpointBuilder - AudioEndpointBuilder Multimedia Class Scheduler - MMCSS
Now, let’s check if the paths under these two services are the same as well in the registry. Click ‘Start’, type regedit and hit Enter Locate the following key:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ Under services, check for these services: MMCSS and AudioEndpointBuilder. Corresponding to the above two services, the Image path (on the right pane) should be same as the path in ‘services.msc’*
I found it here
Solution 3
I think that there is a compatibility 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.
Solution 4
In my case, this was due to building with target of 64-bit only. I forgot that one of my test servers running Server 2003 was 32-bit. My service runs fine on the 64-bit Server 2008 R2 box.
hacket
Updated on June 04, 2022Comments
-
hacket almost 2 years
I have a service that I've built using the C# ServiceBase class. It works when I run it in Windows 7 and Windows Server 2008; however, it doesn't work on Windows XP.
I created the service using
sc create PBUService binpath= "C:\PBULogger.exe"
. This is the correct path.Nothing is logging in the Event Viewer under anything and my exception handling code doesn't fire either.
I thought maybe I didn't have the correct .NET version installed, but I have 4.0 installed on the XP machine. However, I created this project using Visual Studio Express 2012, which I'm pretty sure uses .NET 4.5 by default. Is this causing an issue? All the classes I'm using are version 4.0.
I have stripped down all my code to the base methods and this still doesn't work. Here is my code:
namespace PBULogger { class PBULoggerService : ServiceBase { protected override void OnStart(string[] args) { try { base.OnStart(args); } catch (Exception ex) { EmailUtility.sendEmail("Service Error", ex.Message + ex.StackTrace); } } protected override void OnStop() { base.OnStop(); } }
Since it doesn't log in the event viewer, it tells me it isn't even trying to start the service.
I found these entries in my registry for the service under 'HKEY_LOCAL_MACHINE/System/ControlSet001/Enum/Services/PBUService/Enum'.
Not really sure what it means.
Anybody know what's going on?
-
hacket about 11 yearsThese two services are totally unrelated to my service. My path is C:\PBULogger.exe, so there is no confusion going on from what I can see. Nothing even remotely similar on my C drive.
-
hacket about 11 yearsHowever, I did verify the same information for my service in my registry and it is there. No difference.
-
hacket about 11 yearsI believe this is the problem, along with John Koerner's comment. I have since found a different solution.
-
Luis over 6 yearsThis tipped us in the right direction to solve our problem on Windows 7: the service entry looked for the service as
c:\program files (x86)\service\something.exe
but the machine actually had ac:\program
file. Issue fixed as soon as the file was deleted.