English 中文(简体)
2008年7月1日至2008年6月30日期间使用窗户服务控制器的剪辑
原标题:Service not responding to the c# program that uses service controller on windows server 2008 r2

我有一个“C#”方案,作为“GUI”为创建的窗口服务。 这项服务可以停止或开始,根据从GUI...a起纽顿新闻活动起的纽州报社,其职能如下。 在我正常的课堂上,该法典将处以罚款。 然而,当我把这个全球倡议的用具放在我的服务器上时,它就没有开始或停止服务。 是否存在我所缺的物品,或者服务器服务与固定板块服务有不同的过程。 我正在使用Windows服务器2008 R2和Vista Business...。 提前感谢。

  public static bool StartService(string serviceName, int timeoutMilliseconds)
    {
        ServiceController service = new ServiceController(serviceName);
        try
        {
            TimeSpan timeout = TimeSpan.FromMilliseconds(timeoutMilliseconds);

            service.Start();
            service.WaitForStatus(ServiceControllerStatus.Running, timeout);
            if (service.Status == ServiceControllerStatus.Running)
                return true;
            else
                return false;



        }
        catch
        {
            // ...
            return false;
        }
    }
最佳回答

两点:

首先,确保你的试捕/渔获区是伐木(或以其他方式通知你)所放弃的任何例外。 还核对服务器活动记录错误。

其次,在服务器上对管理你的方案的账户进行核对许可。 在您在常设仲裁委员会的陈述中,该账户可能没有停止和开始服务的充分许可。

问题回答

暂无回答




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签