Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

FIX: How to resolve Security Exception (ASP.NET)?


Author: Anand Narayanaswamy MVP

SUMMARY

This article will show you how to fix the security exception which occurs when you attempt to deploy an ASP.NET application such as forums, blogs etc.

↑ Back to the top


SYMPTOMS

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.
 
Exception: System.Security.SecurityException: Request Failed

↑ Back to the top


CAUSE

The above error occurs since the domain is not placed under its own application pool on the IIS and also due to lack of proper trust level in the machine.config file on the server.

↑ Back to the top


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.

↑ Back to the top


Community solutions content disclaimer

Microsoft corporation and/or its respective suppliers make no representations about the suitability, reliability, or accuracy of the information and related graphics contained herein. All such information and related graphics are provided "as is" without warranty of any kind. Microsoft and/or its respective suppliers hereby disclaim all warranties and conditions with regard to this information and related graphics, including all implied warranties and conditions of merchantability, fitness for a particular purpose, workmanlike effort, title and non-infringement. You specifically agree that in no event shall Microsoft and/or its suppliers be liable for any direct, indirect, punitive, incidental, special, consequential damages or any damages whatsoever including, without limitation, damages for loss of use, data or profits, arising out of or in any way connected with the use of or inability to use the information and related graphics contained herein, whether based on contract, tort, negligence, strict liability or otherwise, even if Microsoft or any of its suppliers has been advised of the possibility of damages.

↑ Back to the top


Keywords: kbpubmvp, kbpubtypecca, kbhowto, KB555466

↑ Back to the top

Article Info
Article ID : 555466
Revision : 4
Created on : 6/10/2019
Published on : 6/10/2019
Exists online : False
Views : 1582