Tag: installutil

C#InstallUtil / ManagedInstallerClass:为什么键值对不会传递给安装程序上下文参数集合?

我将服务名称传递给参数列表,但是当我查看安装程序上下文时,它不存在: args = new[] { Assembly.GetExecutingAssembly().Location, “/ServiceName=WinService1” }; ManagedInstallerClass.InstallHelper(args); 为什么键值对不会传递到安装程序上下文中? public override void Install(IDictionary stateSaver) { foreach (var param in Context.Parameters) { // ServiceName is not available in the Parameters collection } }

以用户身份安装Windows服务失败

我正在使用.Net framework 3.5版开发Windows服务。 它需要在远程计算机上调用Web服务,我遇到了一个奇怪的安装问题。 我曾经在我的机器上安装它作为User (默认),并在提示时提供我的登录名和密码,一切正常。 然后在某些时候,它停止工作,我发现将其安装为LocalSystem并且工作正常。 现在我正在尝试调用远程Web服务,我从WCF收到错误: There was no endpoint listening at https://www.remote.com/webservice.asmx that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details. 显然,这可能是由于将服务作为LocalSystem (没有Internet访问权限)运行: 没有端点侦听可以接受该消息。 这通常是由不正确的地址或SOAP操作引起的 所以,我已经尝试切换回以User身份安装服务并提供我的凭据(我应该注意,此时我是我的机器的管理员)。 但它不起作用,错误消息(以及InstallUtil日志文件的内容)旁边是无用的: Running a transacted installation. Beginning the Install phase of the installation. […]

使用InstallUtil工具时出现BadImageFormatException错误

我使用.NET 4.0创建并编译了我的Windows服务所以我转到.NET 4.0文件夹并说出类似这样的内容:我将bin文件夹复制到C驱动器以缩短路径: InstallUtil.exe“C:\ bin \ Debug \ MyTestService.exe” 这是我得到的错误: 初始化安装时发生exception:System.BadImageFormatException:无法加载文件或程序集’file:/// C:\ bin Debug \ MyTestService.exe’或其依赖项之一。 尝试加载格式不正确的程序。 所以我不知道该怎么做。

使用InstallUtil安装具有启动参数的Windows服务

我使用InstallUtil来安装我的服务,我只是无法弄清楚如何为它指定启动参数! 这是我的Installer子类: [RunInstaller(true)] public class ServerHostInstaller : Installer { private ServiceInstaller m_serviceInstaller; private ServiceProcessInstaller m_serviceProcessInstaller; private static string s_usage = “Usage:\ninstallutil /i /username= /password= NCStub.Server.Host.exe”; public ServerHostInstaller() { m_serviceInstaller = new ServiceInstaller(); m_serviceInstaller.ServiceName = Program.ServiceName; m_serviceInstaller.DisplayName = Program.ServiceName; m_serviceInstaller.StartType = ServiceStartMode.Automatic; m_serviceProcessInstaller = new ServiceProcessInstaller(); m_serviceProcessInstaller.Account = ServiceAccount.User; Installers.Add(m_serviceInstaller); Installers.Add(m_serviceProcessInstaller); } public override void Install(IDictionary […]