English 中文(简体)
安装窗口服务时的错误 系统安全。
原标题:error while installing window service System.Security.SecurityException

我创建了一个窗口服务,并安装了这一服务。 在安装后,我 star。 它成功启动。

第二天,我做了一些修改,重建和重新安装,但现在还没有安装。

然后,我想到的是安装器的问题,请设一个定制安装器,供我随时更新我的代码。

如果有人需要未来的话,我就这样作。

public class MyInstaller : Installer
    {
        ServiceProcessInstaller spi;
        ServiceInstaller si;
        public MyInstaller()
        {            
            spi = new ServiceProcessInstaller();
            spi.Account = ServiceAccount.LocalSystem;

            si = new ServiceInstaller();
            si.StartType = ServiceStartMode.Manual;
            si.ServiceName = "MyService";
            si.DisplayName = "My Service";
            si.Description = "service installed from command line";

            this.Installers.Add(spi);
            this.Installers.Add(si);

        }
}

我用主要方法对参数增益进行检查。

                            case "-i":
                            case "-install":
                                ti = new TransactedInstaller();
                                mi = new MyInstaller();
                                ti.Installers.Add(mi);
                                string logPath = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "\install.log";
                                ctx = new InstallContext(logPath, cmdline);
                                ti.Context = ctx; //.Context ( ctx );
                                ti.Install(new Hashtable());
                                break;

现在我正试图安装。 I 收到错误 系统:安全。 来文方没有找到,但一些或所有的事件记录都无法搜索。 出入记录:安全

我对它抱着眼,知道服务会试图在安装和书写记录时查阅申请记录。

我没有写任何事件记录。 我有我的伐木日志。 但是,它仍然有违约的行为。

现在如何解决这一问题? 甚至我都同意,它没有安装。

成就

最佳回答

我发现,有时你需要“担任署长”。 如果你从指挥部上安装,你可能需要从“署长”开始

问题回答

我本可以单独提出这一信息的根源,但我通过改变我的服务,把我的工作作为地方系统(我想要的是任何东西)而不是地方服务来决定。

我可以确认,在“窗口7 64bit”和“Windows 10”之下,你必须:

1) run Visual studio command prompt AS ADMINISTRATOR (right click.. Other.. tun as admin)

“在座的影像描述”/</a

2) go to "obj" folder where You have the exe. (cd [all path to obj] ) 3) launch installutil [myservice.exe]

即便不是作为“行政”运作,它甚至连老的赢得7失败了。

注:MSDN作了解释:

(at: https://learn.microsoft.com/en-us/dotnet/framework/windows-services/walkthrough-creating-a-windows-service-application-in-the-component-designer)

“为安装视窗服务,你必须在计算机上持有行政证书,然后重新安装。

:





相关问题
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. ...