Windows 服务对 运行 .exe 文件的限制

Limitations of Windows Service on run the .exe file

我正在尝试使用 windows-Service 从外部设备获取证书。 应该如何处理当前用户的限制?

我有一个 .exe 文件可以从额外的设备 (Token) 获取证书并且它可以正常工作。但是当它使用 WCF 从我的 windows 服务调用时,它没有向我显示所有证书。 它对用户或应用程序有限制吗?

static void LaunchCommandLineApp()
    {
        var path = AppDomain.CurrentDomain.BaseDirectory + 
        @"GetCertificate.exe";
        log.Info("LaunchCommandLineApp basePath is : " + 
        AppDomain.CurrentDomain.BaseDirectory);
        log.Info("LaunchCommandLineApp path is : " + path);
        ApplicationLoader.PROCESS_INFORMATION prcInf = new 
        ApplicationLoader.PROCESS_INFORMATION();
        ApplicationLoader.StartProcessAndBypassUAC(path + " -Verb runAs", 
        out prcInf);
        log.Info("After StartProcessAndBypassUAC");
    }

我认为你的问题是 Windows Service User Account 导致你的 exe 运行 作为该用户而不是当前用户。 read more about Windows Service user accounts.

对于Run a process from a windows service as the current user.