相关疑难解决方法(0)

DWORD应该映射到int还是uint?

在将Windows API(包括数据类型)转换为P/Invoke时,我应该用int或替换DWORD uint吗?

它通常是未签名的,但我看到人们int在任何地方使用它(只是因为CLS警告?甚至.NET Framework本身这样做),所以我从来不确定哪一个是正确的使用它.

.net c# pinvoke winapi dword

31
推荐指数
1
解决办法
4万
查看次数

服务报告“服务报告了无效的当前状态 0。”

请您帮我弄清楚为什么我的服务在事件日志中报告以下错误消息:

[服务名称] 服务报告了无效的当前状态 0。

这是我的主要功能:

static class Program
{
    /// <summary>
    /// The main entry point for the application.
    /// </summary>
    static void Main()
    {
        // Setup Ninject
        var kernel = ConfigureNinject();

        #if DEBUG

        var service = kernel.Get<UpdateTakerStatus>();
        service.onDebug();
        System.Threading.Thread.Sleep(System.Threading.Timeout.Infinite);

        #else

        ServiceBase[] ServicesToRun;
        ServicesToRun = new ServiceBase[] 
        {
            kernel.Get<UpdateTakerStatus>()
        };
        ServiceBase.Run(ServicesToRun);

        #endif
    }
}
Run Code Online (Sandbox Code Playgroud)

...这是我的UpdateTakerStatus课程,我的逻辑在一个新线程中被调用:

public partial class UpdateTakerStatus : ServiceBase
{
    private Thread WorkerThread;
    private AutoResetEvent StopRequest = new AutoResetEvent(false);
    private ServiceStatus serviceStatus = new ServiceStatus();

    public …
Run Code Online (Sandbox Code Playgroud)

c# loops windows-services

5
推荐指数
1
解决办法
4858
查看次数

标签 统计

c# ×2

.net ×1

dword ×1

loops ×1

pinvoke ×1

winapi ×1

windows-services ×1