问题
I start a .Net server side program on my local workstation, but soon it throws a security exception. I searched the web for answers, but no quick fix was found / worked. I just want to run my program. How do I get rid of the exception? I fully trust the program, because its mine.
Edit: Oh, yes, I do run the program from a mapped folder that is mapped to my own local drive for the sake of clarity of folder structures. Thanks for the answers, I try tomorrow to run it directly from my drive.
Edit: When I use directly my drive, it works.
回答1:
.NET 3.5 SP1 has better support for running applications on the local intranet.
If you can't target 3.5 SP1, you can map the share you're running the application from to a local drive and use CasPol to set that mapped drive to a fully trusted location.
回答2:
As a temporary measure, you can type...
caspol -s off
...and all .NET Code Access Security is suspended (until you hit < enter >).
来源:https://stackoverflow.com/questions/197835/how-to-get-rid-of-security-exception