That assembly does not allow partially trusted callers although the zone is fully trusted
Since yesterday, I receive a security exception when I want to开发者_如何学Python run a unit-test from within VS.NET 2008. The error goes like this:
SecurityException: that assembly does not allow partially trusted callers
...
The assembly that failed was : file:///S:/MyProject/MyAssembly.dll
The S: drive is a mapped drive which points to a physical location on my disk.
What I find very strange, is that this used to work for months previously. I mean, I did this all the time. In order to get this to work, I 've created a new security zone with the caspol utility in order to give this S: network share drive FullTrust. In other words, when I run
caspol -m -lg
I see this (I removed the other zones for the sake of brevity):
1.2. Zone - Intranet: LocalIntranet
1.2.1. All code: Same site Web
1.2.2. All code: Same directory FileIO - 'Read, PathDiscovery'
1.2.3. Url - file://R:/*: FullTrust
1.2.4. Url - file://S:/*: FullTrust
1.2.5. Url - file:///S:/*: FullTrust
I've added the 1.2.5 zone just recently because the error that was given, mentionned file:///s:/....
Any ideas ?
Could it be that this has something to do with the installation of VS.NET 2010 or the .NET Framework version 4.0 ?
Try adding
<configuration>
<system.web>
<trust level="Full" />
</system.web>
</configuration>
to your web.config.
精彩评论