System.Security.SecurityException: Request for the permission of type ‘System.Web.AspNetHostingPermission … failed
error message on webpage
Server Error in / Application. Security Exception
Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application’s trust level in the configuration
file.
file.
Exception Details: System.Security.SecurityException: Request for the permission of type ‘System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=********′ failed.
Root Cause:
In IIS 7.5, the default application pool is no longer Network Service, like in IIS 6 (that came with Windows 2003) and IIS 7 (that comes with Windows 2008), but rather a built in account called ApplicationPoolIdentity. This is even more restrictive than Network Service, in that required trust levels for .Net assemblies to be loaded inside an application pool have to be greater than what was permitted with Network Service.

Solutions:
1) The easy way out is just to go back to using Network Service as an application pool identity instead of the ApplicationPoolIdentity used by IIS 7.5. However, this undermines the new security enforcements that the IIS team has created, and kind of defeats the purpose of using IIS 7.5 as opposed to IIS 7.5
2) locate the file which is copied from other computer and unblock it by right click and click unblock

to unblock the files at once use powershell command
https://msdn.microsoft.com/powershell/reference/4.0/microsoft.powershell.utility/Unblock-File
PS C:\> dir C:\Downloads\*PowerShell* | Unblock-File
or
PS C:\> dir C:\Downloads\*PowerShell* | Unblock-File -Verbose
or using stream utility to search and unblock files
1-Download streams.exe from SystInternals - http://technet.microsoft.com/en-us/sysinternals/bb897440.aspx
2-Go to command prompt (cmd.exe)
3-Navigate to where you have streams.exe installed
4-Use command line switches: streams.exe –s –d “”
This removed the Internet Zone restrictions from all files under “” and its subfolders as well. [Deleted :Zone.Identifier:$DATA]
References:
No comments:
Post a Comment