开发者

Run c# .NET Program from network share

开发者 https://www.devze.com 2023-01-08 19:51 出处:网络
got a interesting problem. I placed a c# .net .exe file on a network share. If i try to Start->Run: \\\\hostname\\test.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.

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..."

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 "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.

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.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号