标签: installutil

安装Windows服务失败:服务已存在

我正在尝试重新安装我用C#编写的服务.这是第一次有效.我使用installutil来处理安装,服务列表中出现了服务,我可以启动它.然后我对代码进行了一些更新并卸载了服务.在弄清楚我必须关闭服务窗口后,服务似乎已经消失(即成功卸载).但是,在尝试再次安装服务时,我收到消息说:

System.ComponentModel.Win32Exception: The specified service already exists
Run Code Online (Sandbox Code Playgroud)

这看起来很奇怪,因为我在服务窗口中看不到它.我终于认为在删除有关我的服务的注册表项后发现了问题,但不幸的是,这并没有解决任何问题.

此外,再次卸载对解决问题没有太大作用,因为这会导致矛盾的消息:

System.ComponentModel.Win32Exception: The specified service does not exist as an installed service
Run Code Online (Sandbox Code Playgroud)

我应该相信什么?该服务是否存在?我觉得自己像一个物理学家试图弄清楚猫是死了还是活着.我希望这里有人能够帮助解决这个问题.

c# windows-services installutil

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

installutil.exe不是有效的win32应用程序

当我尝试使用Installutil.exe安装服务时,我收到一条消息:c:\ windows\Microsoft.net\framework\v4.0.30319\Installutil.exe不是有效的Win32应用程序.

在此输入图像描述

installutil win32-process

4
推荐指数
2
解决办法
4868
查看次数

安装util在错误的文件夹上查找服务

3我正在尝试使用批处理文件安装Windows服务,我们称之为"setup.bat".在文件中我有以下命令:

"%SystemRoot%\Microsoft.NET\Framework\v4.0.30319\installutil" "MyService.exe"
Run Code Online (Sandbox Code Playgroud)

当我执行批处理文件(在windows7上以管理员身份运行)时,我得到了这个:

初始化安装时发生异常:System.IO.FileNotFoundException:无法加载文件或程序集'file:/// C:\ Win dows\system32\MyService.exe'或其依赖项之一.系统无法指定指定的文件.实际服务位于 "SomeRandomLocation\MyService.exe". bat文件中 "SomeRandomLocation\setup.bat"

到底是怎么回事?如何从我的"setup.bat"文件夹强制安装它?

这应该是动态的.意思是任何文件夹!

.net c# service installutil batch-file

3
推荐指数
1
解决办法
6862
查看次数

安装.net 2008 Windows服务

我刚刚创建了一个简单的测试Windows服务,但遇到了麻烦.我是Windows服务的新手,所以我不知道我是否做得对.

namespace testWindowsService
{
    public partial class Service1 : ServiceBase
    {
        public Service1()
        {InitializeComponent();}

        protected override void OnStart(string[] args)
        {
            FileStream fs = new FileStream(@"c:\temp\started.txt", FileMode.OpenOrCreate, FileAccess.Write);
            StreamWriter m_streamWriter = new StreamWriter(fs);
            m_streamWriter.BaseStream.Seek(0, SeekOrigin.End);

            m_streamWriter.WriteLine("Service Started on \n" + DateTime.Now.ToShortDateString() + " at " + DateTime.Now.ToShortTimeString());
            m_streamWriter.Flush();
            m_streamWriter.Close();
        }

        protected override void OnStop()
        {
            FileStream fs = new FileStream(@"c:\temp\stopped.txt", FileMode.OpenOrCreate, FileAccess.Write);
            StreamWriter m_streamWriter = new StreamWriter(fs);
            m_streamWriter.BaseStream.Seek(0, SeekOrigin.End);

            m_streamWriter.WriteLine("Service Stopped \n" + DateTime.Now.ToShortDateString() + " at " + DateTime.Now.ToShortTimeString());
            m_streamWriter.Flush(); …
Run Code Online (Sandbox Code Playgroud)

windows web-services installutil visual-studio-2008

2
推荐指数
1
解决办法
2660
查看次数

如何调试自定义Windows服务的安装?

我在C#(4.0)中创建了一个Windows服务,并尝试在命令行中使用installutil工具安装它.但是我得到了一个例外.我设法找出我的代码的哪个部分导致异常 - 使用一些糟糕的日志记录,但不管怎样 - 但现在我想了解原因.所以我想要做的是调试我的Windows服务的安装.

我知道如何调试服务本身,但在这里,我想在服务中调试我的Installer.Install(IDictionary stateSaver)方法的内容.

我试图将调试器附加到cmd.exe进程,但它显然不起作用.我还想将调试器附加到installutil进程,但我不知道如何做到这一点.

我看了一下这篇文章:你如何调试正在安装的Windows服务?和其他几个人但在这种情况下,出于某种原因,这家伙似乎已经在services.msc中提供了他的服务,这不是我的情况.

我怎样才能做到这一点?

c# debugging windows-services installutil

2
推荐指数
1
解决办法
4726
查看次数

使用Installutil安装服务

我有WCF服务要安装在Windows上.

现在我想在运行Windows的服务器上安装它并安装了v3.5 .net框架.

这个服务已经在框架4中编写了,因此它不会运行.

我的问题是我可以使用框架3.5中的"installutil"来安装服务吗?为什么?

===更新===

我有运行wcf的Windows服务.

.net c# wcf installutil

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

运行Installutil以在共享文件夹上安装Windows服务

-你好,

我试图从共享文件夹安装Windows服务,如下所示:

installutil "\\\10.1.5.120\Path1\Path2\MyService.exe"
Run Code Online (Sandbox Code Playgroud)

有这个错误:

Exception occurred while initializing the installation:
System.IO.FileLoadException: Could not load file or assembly 'file://\\10.1.5.120\Path1\Path2\MyService.exe' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515).
Run Code Online (Sandbox Code Playgroud)

在installutil日志文件中没有日志,当我尝试从本地路径安装服务时,它会成功安装.

所以我想知道是否可以从共享路径在PC上安装Windows服务?

谢谢你的帮助.

windows-services installutil

2
推荐指数
1
解决办法
8204
查看次数

InstallUtil抛出AssemblySignatureKeyAttribute的TypeLoadException

在开发计算机上,当我使用InstallUtil时没有错误,该服务已成功安装.
我打算将它安装在另一台计算机上(安装了.Net 4.0),因此我将以下文件复制到目标目录:

  • InstallUtil.exe
  • InstallUtil.exe.config
  • InstallUtilLib.dll

在管理员模式下运行util后,我收到以下异常:

未处理的异常:System.TypeLoadException:无法从程序集'mscorlib,Version = 4.0.0.0,Culture = neutral,PublicKeyToken = b77a5c561934e089'加载类型'System.Reflection.AssemblySignatureKeyAttribute'.System.ModuleHandle.ResolveType(RuntimeModule模块,Int32 typeToken,Int Ptr*typeInstArgs,Int32 typeInstCount,IntPtr*methodInstArgs,Int32 methodInst Count,ObjectHandleOnStack类型)在System.ModuleHandle.ResolveTypeHandleInternal(RuntimeModule模块,Int32 typeToken,RuntimeTypeHandle [] typeInstantiationContext,在System.Reflection.CustomAttribute的System.Reflection.RuntimeModule.ResolveType(Int32 metadataToken,Type [] ge nericTypeArguments,Type [] genericMethodArguments)的RuntimeTypeHandle []遇到hodInstantiationContext).
在System.Reflection.InstallUtil.Main(String [] args)的System.Reflection.RuntimeAssembly.GetCustomAttributes(Type attributeType,Boolean inherit)上的System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeAssembly,m mly,RuntimeType caType)

似乎即使是InstallUtil也无法启动,因此无法安装该服务.
我该怎么检查?

.net windows-services installutil

2
推荐指数
1
解决办法
3339
查看次数

使用 Powershell 中的 InstallUtil 安装服务(接受安装参数)

我正在尝试编写一个 powershell 脚本来安装接受安装参数的服务。

以下内容在命令提示符下有效

C:\Windows\Microsoft.NET\Framework\v4.0.30319>installutil.exe /ControllerGroup=Delivery     /username=userl /password=pwd /unattended    "C:\DocumentProcessingPlatform\Dpp.Service\bin\Debug\Dpp.Service.exe"
Run Code Online (Sandbox Code Playgroud)

但是,当我尝试从 Powershell 运行 installutil 时,它不起作用并给了我一个异常

Powershell脚本

$sn = " ControllerGroup=$line /username=$Username /password=$Password /unattended  ""$ServiceExecutablePath""" 
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\InstallUtil.exe $sn

Exception occurred while initializing the installation:
System.ArgumentException: File  ControllerGroup=Delivery /username=usr /password=pwd /unattended C:\DocumentProcessingPlatform\Dpp.Service\bin\Debug\Dpp.Service.exe does not exist. If this parameter is used as an installer option, the format must be
/key=[value]..
Run Code Online (Sandbox Code Playgroud)

如何将参数传递给 installutil?任何帮助表示赞赏。

service installutil powershell-2.0

2
推荐指数
1
解决办法
8013
查看次数

Windows 服务中的 TCP IP 侦听器

我正在尝试创建一个需要在后台运行并侦听传入流量的 Windows 服务(正常和常规的 TCP 侦听器)

我的代码是:

private TcpListener server;

public void startServer()
    {
       // EventLog.WriteEntry(source, "connected on: " + ipAddress.ToString() + " port: " + Service1.Port.ToString());

        server = new TcpListener(IPAddress.Parse("127.0.0.1"), Service1.Port);

         server.Start();
        while (true)
        {
          var client = server.AcceptTcpClient();


            new Thread(work).Start(client);

        }

 public void work(object client)
    {
        string msg = null;
        var clientLocal = (TcpClient)client;


            using (NetworkStream ns = clientLocal.GetStream())
            using (StreamReader sr = new StreamReader(ns))
            {
            byte[] msgFullArray = new UTF8Encoding(true).GetBytes(msg);
            fs.Write(msgFullArray, 0, msg.Length);
            }
Run Code Online (Sandbox Code Playgroud)

现在,如果您根本不看工作方法,因为每当我启动我的服务时,每当我尝试在我的服务中启动它时它都会冻结:

 var client = …
Run Code Online (Sandbox Code Playgroud)

c# windows-services installutil tcplistener tcpclient

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

无法注册C#Powershell snapin

我已经看到了一些类似的问题,但仍然无法弄清楚如何解决它:我有一个简单的PowerShell cmdlet(只是添加参数)和一个snapin来注册它.问题是我尝试运行installutil我得到

No public installers with the RunInstallerAttribute.Yes attribute could be found
Run Code Online (Sandbox Code Playgroud)

snapin代码:

using System.ComponentModel;
using System.Management.Automation;

namespace Cmdtlets
{
    [RunInstaller(true)]
    class BugBoxSnapin : PSSnapIn
    {

    }
}
Run Code Online (Sandbox Code Playgroud)

我知道有64个32位版本的installutil以及x86和x64 powershells.我的配置是 - 64位机器,平台目标"任何CPU",.NET Framework 4.5.我无法从visual studio引用选择器引用System.Management.Automation,所以我手动更改了csproj文件

<Reference Include="System.Management.Automation" />
Run Code Online (Sandbox Code Playgroud)

我应该在哪个版本的powershell中运行哪个版本的installutil?(我想我尝试了所有组合,但仍然遇到同样的问题).

还有一个问题:在这个工作之后,我将需要与32位COM对象进行交互,我应该如何设置项目?

c# powershell cmdlets installutil

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

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

我将服务名称传递给参数列表,但是当我查看安装程序上下文时,它不存在:

args = new[] { Assembly.GetExecutingAssembly().Location, "/ServiceName=WinService1" };
ManagedInstallerClass.InstallHelper(args);
Run Code Online (Sandbox Code Playgroud)

为什么键值对不会传递到安装程序上下文中?

public override void Install(IDictionary stateSaver)
{
    foreach (var param in Context.Parameters)
    {
       // ServiceName is not available in the Parameters collection
    } 
}
Run Code Online (Sandbox Code Playgroud)

c# windows-services installutil managedinstallerclass

0
推荐指数
1
解决办法
2551
查看次数

用Java中的前参数运行exe

我想在java中使用pre-argument运行一个exe.例如,如果在命令提示符中执行此操作.

C:\> installutil myApp.exe
Run Code Online (Sandbox Code Playgroud)

installutil是myApp.exe的预参数(或命令).这与将正常参数传递给Runtime.getRuntime().exec()或不同Process.start();

谢谢.

java windows subprocess installutil

-4
推荐指数
1
解决办法
296
查看次数