.net 如何在 Windows Server 2008 的程序集中安装文件?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/427686/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How do you install files in the assembly in Windows Server 2008?
提问by Bravax
Typically what I used to do is drag and drop the files onto the GAC folder.
This works in Windows 2000 & 2003, however when I try to do this in Windows Server 2008 I get 'Access is denied'.
通常,我过去所做的是将文件拖放到 GAC 文件夹中。
这适用于 Windows 2000 和 2003,但是当我尝试在 Windows Server 2008 中执行此操作时,我收到“拒绝访问”。
The user that is doing this is a local administrator.
执行此操作的用户是本地管理员。
The only reference I can find to this is: Forum link
我能找到的唯一参考是: 论坛链接
Is there another way to achieve this?
有没有另一种方法来实现这一目标?
Note: I tried running explorer as the administrator, but I get the same error.
注意:我尝试以管理员身份运行资源管理器,但出现相同的错误。
Edit: Ideally whatever solution there is should not turn off UAC, or install any software development kit. (So it can be applied to production servers).
编辑:理想情况下,任何解决方案都不应关闭 UAC,或安装任何软件开发工具包。(所以它可以应用于生产服务器)。
Edit: Does anyone have anymore thoughts on this? I've currently on gone with disabling UAC in dev, however this is unacceptable in live.
编辑:有没有人对此有任何想法?我目前已经在开发中禁用 UAC,但这在现场是不可接受的。
回答by ahin4114
This is a UAC issue in server 2008, some people have recommended stopping UAC, I would not recommend this on a production server. The answer isto use gacutil.
这是服务器 2008 中的 UAC 问题,有些人建议停止 UAC,我不建议在生产服务器上这样做。答案是使用 gacutil。
You do notneed to install the SDK to run this on a production server, the exe and its config file can be deployed from a development machine (and removed after use if desired).
你不是需要安装SDK到生产服务器上运行此,该exe和它的配置文件可以从开发计算机进行部署(如果需要使用后删除)。
Place gacutil.exe and gacutil.exe.config into the WINDOWS\Microsoft.NET\Framework\ folder specific to the version of the framework you are using.
将 gacutil.exe 和 gacutil.exe.config 放入特定于您正在使用的框架版本的 WINDOWS\Microsoft.NET\Framework\ 文件夹中。
Then start a new instance of the command line using "Run as administrator"
然后使用“以管理员身份运行”启动命令行的新实例
Navigate to the C:\WINDOWS\Microsoft.NET\Framework.... folder where you have deployed gacutil
导航到您已部署 gacutil 的 C:\WINDOWS\Microsoft.NET\Framework.... 文件夹
Then run: gacutil.exe /i
然后运行:gacutil.exe /i
Hopefully this should resolve your issue (it has worked for me).
希望这可以解决您的问题(它对我有用)。
Good luck.
祝你好运。
回答by Aamir
Go to visual studio or .NET command prompt and type the command:
转到 Visual Studio 或 .NET 命令提示符并键入命令:
gacutil -if "fullpathhere.dll"
explore gacutil command more. -IF means install forcefully, there are other options as well.
探索 gacutil 命令更多。-IF 表示强制安装,还有其他选项。
If there is no Visual Studio or .NET Framework SDK installed, then you will not have the .NET command prompt. In that case, I think you will have to turn off the UAC from Control Panel to drag-drop an Assembly into the Assembly folder.
如果未安装 Visual Studio 或 .NET Framework SDK,则不会有 .NET 命令提示符。在这种情况下,我认为您必须从控制面板关闭 UAC 才能将程序集拖放到程序集文件夹中。
回答by Valentino Vranken
The trick explained by Paulo Oliveira works but not in all circumstances. On Windows Server 2008 R2 I've already deployed the following tactic:
Paulo Oliveira 解释的技巧有效,但并非在所有情况下都有效。在 Windows Server 2008 R2 上,我已经部署了以下策略:
(ensure you're logged on with an account that has admin rights on the server)
(确保您使用在服务器上具有管理员权限的帐户登录)
- open Local Security Policy(Start button, type "local"...)
- navigate to Security Settings > Local Policies > Security Options
- locate the policy called User Account Control: Run all administrators in Admin Approval Mode
- 打开本地安全策略(开始按钮,输入“本地”...)
- 导航到安全设置 > 本地策略 > 安全选项
- 找到名为User Account Control: Run all administrators in Admin Approval Mode 的策略
You'll probably find that this policy in enabled. Disable it, reboot the server and now you should be able to use the regular drag & drop method.
您可能会发现此策略已启用。禁用它,重新启动服务器,现在您应该能够使用常规的拖放方法。
Do not forget to enable this setting again when you're done.
完成后不要忘记再次启用此设置。
(参考:http: //blogs.msdn.com/b/mossbiz/archive/2010/06/10/add-an-assembly-to-the-global-assembly-cache-on-windows-server-2008-r2 .aspx)
回答by Paulo Oliveira
Run a command prompt with "Run as Administrator". Execute command "explorer C:\windows\assembly". This window accepts drop of DLL's from another explorer executed with "Run as administrator privileges.
使用“以管理员身份运行”运行命令提示符。执行命令“资源管理器 C:\windows\assembly”。此窗口接受从另一个以“以管理员身份运行”权限执行的资源管理器中删除 DLL。
Hope it helps
希望能帮助到你
回答by ermurri
If you change the Local Security Policy on the Win2008 server (or Win7), you can use the old drag/drop method:
如果在 Win2008 服务器(或 Win7)上更改本地安全策略,则可以使用旧的拖放方法:
回答by Eduardo Campa?ó
I've never tried it in Windows Server 2008, but have you tried from Control Panel / Administrative tools / .NET Framework 2.0 Configuration ?
我从未在 Windows Server 2008 中尝试过,但您是否在控制面板/管理工具/.NET Framework 2.0 配置中尝试过?
回答by Iturea
If its a 3.5 dll or older, drag drop into start / run / assembly. If its a 4.0 dll or newer, you should run gacutil and then look in windows / microsoft.net / assembly. For prod, just write a batch file and copy over the gacutil app for setup purposes. No need to install VS in prod.
如果它是 3.5 dll 或更旧的版本,请拖放到开始/运行/程序集。如果它是 4.0 dll 或更新版本,您应该运行 gacutil,然后查看 windows/microsoft.net/assembly。对于 prod,只需编写一个批处理文件并复制 gacutil 应用程序即可进行设置。无需在产品中安装 VS。

