简体   繁体   English

从网络共享运行c#.NET程序

[英]Run c# .NET Program from network share

got a interesting problem. 有一个有趣的问题。 I placed ac# .net .exe file on a network share. 我在网络共享上放置了ac .net .exe文件。 If i try to 如果我试着

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

my software starts properly and everything is working. 我的软件启动正常,一切正常。

We also have a DNS Alias set for this computer, so if I try to run my program by: 我们还为此计算机设置了DNS别名,因此如果我尝试通过以下方式运行我的程序:

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

My programm will cause an error message: " test has encountered a problem and needs to close... " 我的程序将导致错误消息:“ 测试遇到问题,需要关闭...

On client .net 2.0, 3.0, 3.5sp1 is installed. 在客户端.net 2.0,3.0,3.5sp1已安装。 There is a full trust caspol for the network share (set with dnsalias). 网络共享有一个完全信任的caspol(使用dnsalias设置)。

Caspol "tweaks" are a bit of a pain to deploy robustly. Caspol“调整”有点强大地部署。 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. IMO,从网络上运行exe的最佳方式是核心框架首先不会反对的方式。

Since you have 3.5 SP1, one simple way is to map the share to a drive. 由于您有3.5 SP1,一种简单的方法是将共享映射到驱动器。 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. IIRC,使用此Service Pack,“j:\\ test.exe”将受信任,即使“j:”映射到“\\ hostname”,“\\ hostname \\ test.exe”可能不受信任。

The other approach is ClickOnce; 另一种方法是ClickOnce; you publish to the network share and run "test.application" instead. 您发布到网络共享并运行“test.application”。 This also gives you options like local-copy with auto-update, file extension handling, etc. 这也为您提供了自动更新,文件扩展名处理等本地副本等选项。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM