使用位于网络驱动器上的程序集运行InstallUtil.exe [英] Run InstallUtil.exe with an assembly located on a network drive

查看:86
本文介绍了使用位于网络驱动器上的程序集运行InstallUtil.exe的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨呀,



不要问我为什么,但我正在尝试使用InstallUtil.exe安装服务,并且程序集位于一个网络驱动器,例如:



InstallUtil.exe Z:\ somepath \ MyService.exe



这就是我得到的:



初始化安装时发生异常:

System.IO.FileLoadException:无法加载文件或程序集'file:/// Z:\ somepath \ MyService.exe'或其依赖项之一。不支持操作。 (来自HRESULT的异常:0x80131515)。

Microsoft(R).NET Framework安装实用程序版本4.0.30319.1

版权所有(c)Microsoft Corporation。保留所有权利。



任何提示?



我知道我可以将所有内容复制到C并执行从那里,但如果我能从网络驱动器上做到这将是非常好的。



谢谢。

布鲁斯

Hi ya'll,

don't ask me why, but I'm trying to install a service using InstallUtil.exe and the assembly is located on a network drive, e.g.:

InstallUtil.exe Z:\somepath\MyService.exe

This is what I'm getting:

Exception occurred while initializing the installation:
System.IO.FileLoadException: Could not load file or assembly 'file:///Z:\somepath\MyService.exe' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515).
Microsoft (R) .NET Framework Installation utility Version 4.0.30319.1
Copyright (c) Microsoft Corporation. All rights reserved.

Any hints?

I know I could copy everything to C and do it from there, but it would be really nice if I could do it from a network drive.

Thanks.
Bruce

推荐答案

这个想法有很多问题。



首先,服务必须由UNC路径指定,而不是映射的驱动器号。



服务必须设置为在有权访问.EXE所在的共享的用户帐户下执行。这是因为服务必须像普通用户一样登录Windows。



服务还必须设置为依赖于其他服务,例如TCP / IP Netbios Helper。 Windows启动时无法立即使用网络服务。您的服务必须等到它们可用才能启动它。



如果Windows因服务或网络启动时无法使用该共享怎么办问题??您的服务将无法启动,因为您添加了不必要的网络访问依赖性。



如果从网络源运行,托管代码可执行文件也在隔离的沙箱中运行。您必须更改机器上的策略才能解决问题,例如信任使用特定证书签名的可执行文件。





最重要的是,这是一个糟糕的主意,很多依赖项为你创造了更多的工作,而不是试图从中心源运行这个.EXE。只需在本地安装它就可以省去一堆麻烦。
There are LOTS of problems with this idea.

First, the service has to be specified by a UNC path, not a mapped drive letter.

The service MUST be setup to execute under a user account that has access to the share the .EXE is sitting in. This is because services have to login to Windows the same as normal users do.

The service must also be setup to depend on other services, such as the TCP/IP Netbios Helper. Network services are not available immediately when Windows starts. Your service will have to wait until they are available in order to even launch it.

What if the share isn't available when Windows starts because of a service or network problem?? Your service will not start as you're added the unneccessary dependency of having network access available.

Managed code executables also run in a isolated sandbox if running from a network source. You'll have to change policies on the machine in order to get around that, like trusting executables signed with a certain certificate.


The bottom line is this is a bad idea with LOTS of dependencies that are creating more work for you than you're saving trying to run this .EXE from a central source. Just install it locally and you'll save yourself a bunch of headaches.


正如错误所说,'service.exe'需要一个程序集。您可能没有在本地计算机上安装该程序集(可能在GAC中)。使用此工具查看依赖项。 http://www.red-gate.com/products/dotnet-development/reflector/ [ ^ ]
as the error says, there is an assembly needed by 'service.exe'. you may not have that assembly on your local machine (possibly in the GAC). use this tool to see dependencies. http://www.red-gate.com/products/dotnet-development/reflector/[^]


这篇关于使用位于网络驱动器上的程序集运行InstallUtil.exe的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆