I have developed an Asp.net website in Visual Studio 2008 and it worked fine while using Vista OS but my workstation got upgraded to Windows 7 and I now get following error:
Try this
Go to the properties of precompiled dll’s, check to see if it has following security message (at the bottom of the window): "This file came from another computer and might be blocked to help protect this computer." If present, click "Unblock", "Apply" and "OK".
OR
Run the below caspol command to resolve the issue Drive:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\caspol.exe -m -ag 1 -url file:////c:\mysitecontent\*
FullTrust -exclusive on
Note: Please substitute c:\mysitecontent\*
with actual path where ASP.net pre-compiled DLLs are located.
And restart the system.
If it helped you vote it up please.
This worked for me. in web.config add
<system.web>
<trust level="Full" />
</system.web>
I was getting the same error...so I solved with two steps. First, adding code in web.config file.
and second, changing the IIS Manger. Select the server in IIS. Click/Open Feature Delegation under management. Than, change .NET Trust Level to Read/Write (from right hand Action panel)
Thanks
This is an old question, but I experienced this exact issue recently and as the problem existed on the local machine and not on a remote one like most of the rest of the information pulled up with this particular error, none of those solutions helped so I'm going to put my solution here.
My issue was that I was using a networked workstation and trying to run a solution that was stored on a network drive. For some reason, my local machine did not trust that particular drive and it would not accept any of the attempts to raise the trust level of the application.
Once I realized the issue was the drive itself, I simply moved the entire solution over to another one and it solved the problem for me. I imagine that a talk with the Network Admin about their permissions could likely helped to correct the error also, but just switching the solution to a local drive fixed the issue that I was having and might work for others.
RESOLUTION
To resolve this behavior, grant the FullTrust right to the remote share:
On the Web server, open Administrative Tools, and then double-click Microsoft .NET Framework Configuration.
Expand Runtime Security Policy, expand Machine, and then expand Code Groups.
Right-click All_Code, and then click New.
Select Create a new code group. Give your code group a relevant name, such as the name of the applications share. Click Next.
In the Choose the condition type for this code group list, select URL.
In the URL box, type the path of the share in the following format:
file:////\\computername\sharename\*
Note Replace computername with the name of the computer that is hosting the remote share. Replace sharename with the name of the share.
Click Next. On the next page, select Use an existing permission set, and then select FullTrust.
Click Next, and then click Finish.
Restart Microsoft Internet Information Services (IIS) to restart the ASP.NET worker process.
If Microsoft .NET Framework Configuration is not displayed under Administrative Tools, you can install the .NET Framework SDK to add Microsoft .NET Framework Configuration. Alternatively, you can run the following command to make the change:
Drive:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\caspol.exe -m -ag 1 -url "file:////\\computername\sharename\*" FullTrust -exclusive on
For more details: https://support.microsoft.com/en-us/kb/320268
RESOLUTION
(1) Create an application pool for the appropriate domain using Internet Information Services (IIS). Login to the remote desktop and open IIS Manager. Expand the tree Application Pools. Right click and select New | Application Pool and give the required particulars.
(2) The next step is to place the domain under the newly created application pool. In order to perform this action, expand the tree labeled Web Sites and then Default Web Site under it. Select your domain name, right click on it and choose Properties menu item. Select the drop down box labeled Application pool and choose the newly created application pool name.
Note: You can automatically perform the above mentioned steps using certain popular hosting control panels if you have installed them on the server.
(3) Add the following lines of code to machine.config file. This file can be located under the folder - Root Drive Name:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\CONFIG
<location path="yourdomain.com" allowOverride="true">
<system.web>
<trust level="Full" originUrl=""/>
</system.web>
</location>
(A) You should require administrative rights to the server and access to remote desktop to resolve the above issue. You should contact your hosting service provider if you don’t have access to the server.
(B) Replace yourdomain.com with the appropriate domain name in which the problem is occurring.
Warning: Incorrect modification of machine.config file will cause problems to the ASP.NET service on the server.