0

I am trying to resolve the issue since long when putting code in web.config it is giving error as "Parser Error Message: It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS."

When removing , it is giving error " 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. " Help me out!

1 Answers1

0

Try this:

<system.web>
   <trust level="Full"/>
</system.web>

I found this approach in this post.

Also I'd suggest you reading https://support.microsoft.com/en-us/kb/320268

UPDATE 1:

As said in the FIX: How to resolve Security Exception (ASP.NET)?, 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>
  <customErrors mode="Off"/> //Referred from https://www.codeproject.com/questions/586223/securityplusexceptionpluscomingplusinplusaplusrunn
  <trust level="Full" originUrl=""/>
 </system.web>
</location>
StackUseR
  • 884
  • 1
  • 11
  • 40
  • when i am adding , then it is generating error as "Parser Error Message: It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS." – Hardik Nadiyana Nov 28 '16 at 11:54
  • have a look at Solairaja's answer in [Virtual Directory not being configured as an application in IIS](http://stackoverflow.com/a/1938797/5588347). – StackUseR Nov 28 '16 at 11:58
  • No Still problem persists, i tried with but no success. Offline complete website is working fine but online it is generating issue. – Hardik Nadiyana Nov 28 '16 at 12:12
  • I believe its a configuration issue. have a look at the updated answer. – StackUseR Nov 28 '16 at 12:17
  • when i am adding it is showing following inputs on the screen as Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately. Parser Error Message: It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS. My folder is configured as IIS & it is working fine on local server. – Hardik Nadiyana Dec 02 '16 at 11:30
  • `Clean` the project. then go to **project properties -> Web -> Create Virtual Directory.** that should resolve the error. – StackUseR Dec 02 '16 at 11:37
  • No ways i am not able to resolve. My web server has two folders having same software. At a time either of the folder works. But each has been configured as independent folders for specific website. I am completely helpless... what to do? snehbandhan.co.in here error is generating and dnyanarjan.com/frmmemberlogin.aspx is working is fine. – Hardik Nadiyana Dec 02 '16 at 13:37