5

So I get this error when publishing my ASP.NET MVC application. It works fine locally:

" This happens when the site administrator has locked access to this section using <location allowOverride="false"> from an inherited configuration file.

I had this error before that I fixed:

"System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed."

I used the following code in my Web.config file:

<securityPolicy>
  <trustLevel name="Full" policyFile="internal"/>
</securityPolicy>

So does anyone know how I can change my: "<location allowOverride="false"> to true? Cause that must be the problem.

Cleon
  • 157
  • 1
  • 2
  • 13

3 Answers3

2

In IIS Manager, select the server node and in the bottom section Feature Delegation. Find your feature and change it to Read/Write.

You have to be an administrator to change this setting.

Peter Hahndorf
  • 10,767
  • 4
  • 42
  • 58
  • Ok I know this sounds very strange, but I dont have any IIS Manager on my PC. Iv'e tried all this steps but does not work: https://technet.microsoft.com/en-us/library/cc785858%28v=ws.10%29.aspx – Cleon May 21 '15 at 13:23
  • Ok nevermind, I installed it. Where is the server node exactly? – Cleon May 21 '15 at 13:32
  • @Cleon - In the tree on the left-hand side, it has your computer's name. – Peter Hahndorf May 21 '15 at 13:33
  • Ok so Im in Feature Delegation. Which feature should I change to Read/Write? – Cleon May 21 '15 at 13:35
  • Should I just change them all to Read/Write? – Cleon May 21 '15 at 13:37
  • No, you should have them the same way your production server is set up. This section allows certain settings to be overwritten in local web.config, Read/Write gives more power to anybody who can edit the web.config. It all depends on your environment, but keep in mind that maybe on a production server you wont have access to these settings. – Peter Hahndorf May 21 '15 at 13:51
  • @Cleon change the .NET Trust Levels Delegation to Read/Write and it should work – Ravi Patil Sep 21 '21 at 10:25
1

I was getting the same error...so I solved with two steps. First, adding code in web.config file.

<location path="yourdomain.com" allowOverride="true">
  <system.web>
    <trust level="Full" originUrl=""/>
  </system.web>
</location>

and second, changing IIS Manger. select the server. Open Feature Delegation under management change .NET Trust Level to Read/Write (from right hand Action panel)

Thanks

Ryan Koir
  • 11
  • 4
1

For me, it was that I forgot that I had modified the "generic" web.config (the one that is located in C:\Windows\Microsoft.NET\Framework{Your .NET Framework}\Config\web.config).

I had added <location allowOverride="false">, so I removed this tag and it worked as usual.

manna
  • 188
  • 3
  • 7