从网络共享运行c#.NET程序 [英] Run c# .NET Program from network share

查看:44
本文介绍了从网络共享运行c#.NET程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

遇到了一个有趣的问题.我在网络共享上放置了一个c#.net .exe文件.如果我尝试

got a interesting problem. I placed a c# .net .exe file on a network share. If i try to

Start->Run: \\hostname\test.exe

我的软件可以正常启动,并且一切正常.

my software starts properly and everything is working.

我们还为此计算机设置了DNS别名,因此,如果我尝试通过以下方式运行程序,

We also have a DNS Alias set for this computer, so if I try to run my program by:

Start->Run: \\mydnsalias\test.exe

我的程序将导致错误消息:"测试遇到问题,需要关闭... "

My programm will cause an error message: "test has encountered a problem and needs to close..."

在客户端.net 2.0、3.0上安装了3.5sp1.对于网络共享(使用dnsalias设置),有一个完全信任的级联.

On client .net 2.0, 3.0, 3.5sp1 is installed. There is a full trust caspol for the network share (set with dnsalias).

推荐答案

Caspol的调整"对于稳健部署有些麻烦.IMO,从网络上运行exe的最佳方法是,首先不要让核心框架成为对象.

Caspol "tweaks" are a bit of a pain to deploy robustly. IMO, the best way to run an exe off the network is in a way that the core framework isn't going to object to in the first place.

由于具有3.5 SP1,一种简单方法是将共享映射到驱动器.使用此Service Pack的IIRC,即使将"j:"映射到"\ hostname",并且"\ hostname \ test.exe"可能被信任.

Since you have 3.5 SP1, one simple way is to map the share to a drive. IIRC, with this service pack, "j:\test.exe" will be trusted, even though "j:" is mapped to "\hostname", and "\hostname\test.exe" might not be trusted.

另一种方法是ClickOnce;您发布到网络共享并运行"test.application".这还为您提供了诸如具有自动更新功能的本地复制,文件扩展名处理等选项.

The other approach is ClickOnce; you publish to the network share and run "test.application" instead. This also gives you options like local-copy with auto-update, file extension handling, etc.

这篇关于从网络共享运行c#.NET程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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