Understanding LinkDemand Security on a webserver
After deployment an ASP.Net application on a webserver, I get this error message by using code from a external assembly: "LinkDemand The type of the first permission that failed was: System.Security.PermissionSet The Zone of the assembly that failed was: MyComputer the error ".
The assembly is include in the \bin folder and not in the GAC.
I try to know what linkdemand exactly is and why this message will raised. But looking for more information, I don't get exactly the problem.
I try also to add the PermissionSetAttribute on the class where the exception message happens:
[System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Name = "FullTrust")]
Then the exception will be raised on another class of the assembly. And so on..
My questions ares:
what exactly is going wrong here? Is it true that what I understand this error message displayed when the Jit cannot 开发者_JS百科check the code security?
Is there maybe a security policy that block this (machine.config) or directly change the security?
- Can I set the PermissionAttribute for all classes between a assembly?
Go to administrative tools and local security policy. Whilst, I do not know the exact reason you are getting the error, basically you are trying to execute code that is not allowed in the current security policy. Check your paths and your security policy and the permission requirements of the module. Some paths like desktop will run in reduced security by default.
精彩评论