Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/windows/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.net 在特定计算机上安装Windows服务失败?_.net_Windows_Batch File_Windows Services - Fatal编程技术网

.net 在特定计算机上安装Windows服务失败?

.net 在特定计算机上安装Windows服务失败?,.net,windows,batch-file,windows-services,.net,Windows,Batch File,Windows Services,我安装了一个Windows服务,其中包含以下代码(bat文件): 这在几乎所有运行Windows Server的计算机上都非常有效。有时,bat文件必须重新保存为ANSI或UTF8,但在这之后,大多数情况下都能正常工作 但是,我已经运行到Windows Server 2012计算机,在使用install.but fil时出现以下异常: Installing IEPPAMS Win Service... -----------------------------------------------

我安装了一个Windows服务,其中包含以下代码(bat文件):

这在几乎所有运行Windows Server的计算机上都非常有效。有时,bat文件必须重新保存为ANSI或UTF8,但在这之后,大多数情况下都能正常工作

但是,我已经运行到Windows Server 2012计算机,在使用install.but fil时出现以下异常:

Installing IEPPAMS Win Service...
---------------------------------------------------
Microsoft (R) .NET Framework Installation utility Version 4.0.30319.18010
Copyright (C) Microsoft Corporation.  All rights reserved.


Running a transacted installation.

Beginning the Install phase of the installation.
See the contents of the log file for the C:\MyAppService54\MyApp5.WindowsService
.exe assembly's progress.
The file is located at C:\MyAppService54\MyApp5.WindowsService.InstallLog.
Installing assembly 'C:\MyAppService54\MyApp5.WindowsService.exe'.
Affected parameters are:
   logtoconsole =
   assemblypath = C:\MyAppService54\MyApp5.WindowsService.exe
   logfile = C:\MyAppService54\MyApp5.WindowsService.InstallLog
Unable to create an instance of the MyApp5.WindowsService.ProjectInstaller insta
ller type.
System.Reflection.TargetInvocationException: Exception has been thrown by the ta
rget of an invocation.
The inner exception System.NullReferenceException was thrown with the following
error message: Object reference not set to an instance of an object..

An exception occurred during the Install phase.
System.InvalidOperationException: Unable to create an instance of the MyApp5.Win
dowsService.ProjectInstaller installer type.
The inner exception System.Reflection.TargetInvocationException was thrown with
the following error message: Exception has been thrown by the target of an invoc
ation..
The inner exception System.NullReferenceException was thrown with the following
error message: Object reference not set to an instance of an object..

The Rollback phase of the installation is beginning.
See the contents of the log file for the C:\MyAppService54\MyApp5.WindowsService
.exe assembly's progress.
The file is located at C:\MyAppService54\MyApp5.WindowsService.InstallLog.
Rolling back assembly 'C:\MyAppService54\MyApp5.WindowsService.exe'.
Affected parameters are:
   logtoconsole =
   assemblypath = C:\MyAppService54\MyApp5.WindowsService.exe
   logfile = C:\MyAppService54\MyApp5.WindowsService.InstallLog
Unable to create an instance of the MyApp5.WindowsService.ProjectInstaller insta
ller type.
System.Reflection.TargetInvocationException: Exception has been thrown by the ta
rget of an invocation.
The inner exception System.NullReferenceException was thrown with the following
error message: Object reference not set to an instance of an object..
An exception occurred during the Rollback phase of the System.Configuration.Inst
all.AssemblyInstaller installer.
System.InvalidOperationException: Unable to create an instance of the MyApp5.Win
dowsService.ProjectInstaller installer type.
The inner exception System.Reflection.TargetInvocationException was thrown with
the following error message: Exception has been thrown by the target of an invoc
ation..
The inner exception System.NullReferenceException was thrown with the following
error message: Object reference not set to an instance of an object..
An exception occurred during the Rollback phase of the installation. This except
ion will be ignored and the rollback will continue. However, the machine might n
ot fully revert to its initial state after the rollback is complete.

The Rollback phase completed successfully.

The transacted install has completed.
The installation failed, and the rollback has been performed.
---------------------------------------------------
Press any key to continue . . .

我看到它有一个NullRef异常,但我不明白这个?它在所有其他计算机上工作正常。我知道这个特定的环境有一些额外的安全规则,可能是这样吗?

通过在资源管理器中启用所有安全设置并重新下载,它工作了。我不确定资源管理器如何能够基于安全性更改zip文件的内容。我知道阻塞/取消阻塞问题,但不是这个问题。

请从命令promt尝试以下操作:

>sc create "servicenameABC" binPath="path to your service location"
现在转到services.msc,您可以在这里找到您的服务(servicenameABC),
希望有帮助。

很可能是因为“额外的安全规则”。尝试使用Process Monitor查看是否有底层文件系统操作失败。
>sc create "servicenameABC" binPath="path to your service location"