Elmah on IIS 6 Drawer

I have a website where elmah runs on it by entering sql square. In my test, env is an IIS 7 machine and everything works fine. When I load web servers with IIS 6 network, I get an error

[SecurityException: Request for the permission of type 'System.Configuration.ConfigurationPermission, System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' failed.]
   System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet) +0
   System.Security.CodeAccessPermission.Demand() +58
   System.Configuration.BaseConfigurationRecord.CheckPermissionAllowed(String configKey, Boolean requirePermission, Boolean isTrustedWithoutAptca) +99

The website is designed to run .net 3.5. All of our pages work fine, but elmah gives this error. I did some searches, but cannot find what I installed incorrectly. I wanted someone else to decide.

+3
source share
1 answer

I suspect your hoster is running ASP.NET in the trust facility. There are a few things to try.

Add an attribute requirePermission="false"to each of the Elmah configuration sections declared in yours web.config, for example:

<sectionGroup name="elmah">
  <section name="security" type="Elmah.SecuritySectionHandler, Elmah" 
           requirePermission="false"/>
  <section name="errorLog" type="Elmah.ErrorLogSectionHandler, Elmah" 
           requirePermission="false"/>
</sectionGroup>

, , <system.web> web.config:

<trust level="Full"/>

, . , , .

Update:

requirePermission: " " .

, requirePermission="false". <section name="..." type="..." /> web.config. , :

<section name="errorLog" type="Elmah.ErrorLogSectionHandler, Elmah" 
       requirePermission="false"/

, , , Elmah :

<errorLog type="Elmah.VistaDBErrorLog, Elmah" connectionStringName="ElmahDB" />
+2

Source: https://habr.com/ru/post/1789812/


All Articles