“When the site administrator has locked access to this section using <location allowOverride=”false“> from an inherited configuration file.”

半世苍凉 提交于 2019-12-13 14:01:08

问题


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.


回答1:


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.




回答2:


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




回答3:


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.



来源:https://stackoverflow.com/questions/30374806/when-the-site-administrator-has-locked-access-to-this-section-using-location-a

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!