c# launch .exe from a remote folder
I made a .exe program in c# and locally works fine... but if I put the .exe into a remote path, when I launch, it gives error.. I use framework 2.0 how can I solve this?
thanks
edit: this is the error:
and if I launch the program locally, it works fine ( I copied 开发者_开发技巧all the folder with directories...)
That is "code access security"; a random network share has very little trust from the core engine by default. With 2.0, your options are:
- use a ClickOnce instead (execute the
.application
, not the.exe
) - use
caspol.exe
(on every client) to tell it to trust the share - don't deploy that way (i.e. use an installer)
With some of the later service packs (it might be SP 2, I can't remember), mapped shares get more trust, i.e. \\server\share
won't have enough trust by default, but h:
(which is mapped to \\server\share
) will run.
My preference would be the ClickOnce deployment since it works on all versions.
If feasible, upgrade to .NET 3.5 SP1. This .NET Framework version will allow you to start executables off a network share:
.NET Framework 3.5 SP1 Allows managed code to be launched from a network share!
精彩评论