{"id":2321,"date":"2022-08-30T15:23:53","date_gmt":"2022-08-30T15:23:53","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/01\/05\/servicebase-service-error-1930xc1-on-windows-xp-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:23:53","modified_gmt":"2022-08-30T15:23:53","slug":"servicebase-service-error-1930xc1-on-windows-xp-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/servicebase-service-error-1930xc1-on-windows-xp-collection-of-common-programming-errors\/","title":{"rendered":"ServiceBase service error 193:0xc1 on Windows XP-Collection of common programming errors"},"content":{"rendered":"<p>I have a service that I&#8217;ve built using the C# ServiceBase class. It works when I run it in Windows 7 and Windows Server 2008; however, it doesn&#8217;t work on Windows XP.<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/i.stack.imgur.com\/TOAez.png\" \/><\/p>\n<p>I created the service using <code>sc create PBUService binpath= \"C:\\PBULogger.exe\"<\/code>. This is the correct path.<\/p>\n<p>Nothing is logging in the Event Viewer under anything and my exception handling code doesn&#8217;t fire either.<\/p>\n<p>I thought maybe I didn&#8217;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&#8217;m pretty sure uses .NET 4.5 by default. Is this causing an issue? All the classes I&#8217;m using are version 4.0.<\/p>\n<p>I have stripped down all my code to the base methods and this still doesn&#8217;t work. Here is my code:<\/p>\n<pre><code>namespace PBULogger {\n    class PBULoggerService : ServiceBase {\n    protected override void OnStart(string[] args) {\n        try {\n           base.OnStart(args);\n        } catch (Exception ex) {\n            EmailUtility.sendEmail(\"Service Error\", ex.Message + ex.StackTrace);\n        }            \n    }\n\n    protected override void OnStop() {\n        base.OnStop();\n    }\n}\n<\/code><\/pre>\n<p>Since it doesn&#8217;t log in the event viewer, it tells me it isn&#8217;t even trying to start the service.<\/p>\n<p>I found these entries in my registry for the service under &#8216;HKEY_LOCAL_MACHINE\/System\/ControlSet001\/Enum\/Services\/PBUService\/Enum&#8217;.<\/p>\n<p>Not really sure what it means.<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/i.stack.imgur.com\/1YWXO.png\" \/><\/p>\n<p>Anybody know what&#8217;s going on?<\/p>\n<ol>\n<li>\n<p>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:<\/p>\n<pre><code>\/\/ %1 is not a valid Win32 application.\n\/\/\n#define ERROR_BAD_EXE_FORMAT             193L\n<\/code><\/pre>\n<p>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.<\/p>\n<\/li>\n<li>\n<p>I found this after googling the windows service error number: *Generally the error message means that the service manager couldn&#8217;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.<\/p>\n<p>Click &#8216;Start&#8217; and type &#8216;services.msc&#8217; and hit Enter Check for the multimedia class scheduler and audio endpoint builder service. Check for the path under &#8220;path to executable:&#8221; 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:<\/p>\n<p>AudioEndpointBuilder &#8211; AudioEndpointBuilder Multimedia Class Scheduler &#8211; MMCSS<\/p>\n<p>Now, let&#8217;s check if the paths under these two services are the same as well in the registry. Click &#8216;Start&#8217;, type regedit and hit Enter Locate the following key:<\/p>\n<p>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 &#8216;services.msc&#8217;*<\/p>\n<p>I found it here<\/p>\n<\/li>\n<li>\n<p>In our case this happened after a server crash and the exe file got corrupted. We re-deployed the binaries and then the service started successfully.<\/p>\n<\/li>\n<\/ol>\n<p id=\"rop\"><small>Originally posted 2014-01-05 10:10:07. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>I have a service that I&#8217;ve built using the C# ServiceBase class. It works when I run it in Windows 7 and Windows Server 2008; however, it doesn&#8217;t work on Windows XP. I created the service using sc create PBUService binpath= &#8220;C:\\PBULogger.exe&#8221;. This is the correct path. Nothing is logging in the Event Viewer under [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-2321","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/2321","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=2321"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/2321\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=2321"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=2321"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=2321"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}