ServiceBase服务错误193:在Windows XP 0xc1 [英] ServiceBase service error 193:0xc1 on Windows XP

查看:356
本文介绍了ServiceBase服务错误193:在Windows XP 0xc1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有,我已经使用C#ServiceBase类建立了服务。它的工作原理,当我在Windows 7和Windows Server 2008中运行;然而,它并不在Windows XP上工作。

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.

我用 SC创建PBUService binpath =C:\PBULogger.exe。这是正确的道路。

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.

我想,也许我没有安装正确的.NET版本,但我已经安装了XP的机器上4.0。不过,我创建了使用Visual Studio Express的2012年,我敢肯定,默认情况下使用.NET 4.5这一项目。难道这造成的一个问题?我使用所有的类都是4.0版本。

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.

我发现我的注册表这些条目服务下的HKEY_LOCAL_MACHINE /系统/ ControlSet001 /枚举/服务/ PBUService /枚举。

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?

推荐答案

您必须编译你的EXE无论是.NET 4.5或64位架构(或两者)。这是错误代码碰上从 WinError解释.H

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

请确保你编译它x86平台或任何CPU,并且对安装在机器上编译.NET Framework的任何版本。

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.

这篇关于ServiceBase服务错误193:在Windows XP 0xc1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆