IIS 6盒上的Elmah [英] elmah on IIS 6 box

查看:209
本文介绍了IIS 6盒上的Elmah的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个运行着elmah的网站,并在其中记录了一个SQL框。在我的测试环境中,它是一台IIS 7计算机,并且一切正常。当我上传到运行IIS 6的网络解决方案网站时,出现错误

I've got a web site with elmah running on it logging to a sql box. In my test env it's a IIS 7 machine and all works well. When i upload to a network solutions web running IIS 6 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

该网站设置为运行.net 3.5。我们所有的页面都能正常工作,但是elmah会出现此错误。我进行了一些搜索,但找不到正确设置的内容。希望其他人已经解决了这个问题。

The website is setup to run .net 3.5. All of our pages work fine, but elmah gives this error. I've done some searching but can't find what i've setup incorrectly. Was hoping someone else has already solved this.

推荐答案

我怀疑您的托管服务商正在Medium Trust中运行ASP.NET。有几件事可以尝试。

I suspect your hoster is running ASP.NET in Medium Trust. There's a couple of things to try.

requirePermission = false 属性添加到在<$ c $中声明的每个Elmah配置节中c> web.config ,例如:

Add the requirePermission="false" attribute to each of the Elmah configuration sections declared in your 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>

如果这不起作用,您也可以尝试通过将信任级别添加到<$ c中来覆盖信任级别您的 web.config 文件中的$ c>< system.web> :

If this doesn't work you could also try overriding the trust level by adding this to <system.web> in your web.config file:

<trust level="Full"/>

如果这不起作用,则可能需要联系托管人并要求他们放松信任政策。但是,如果您的网站位于共享池中,则他们不太可能会接受这种方式。

If this doesn't work then you may need to contact your hoster and ask them to relax their trust policy. However if your site is in a shared pool it's unlikely that they'll entertain this.

更新:

关于 requirePermission 属性:默认的中级信任策略不允许部分受信任的调用者访问配置文件设置,即使在您自己的应用程序中也是如此。

About the requirePermission attribute: The default Medium Trust policy doesn't permit partially trusted callers access to configuration file settings, even in your own application.

您可以通过设置 requirePermission = false 选择覆盖应用程序的本地配置设置。这是在 web.config中的< section name = ... type = ... /> 声明中完成的文件。因此,当您设置时:

You can elect to override this for your application's local configuration settings by setting requirePermission="false". This is done in the <section name="..." type="..." /> declarations in your web.config file. So, when you set:

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

有效地说,请授予Elmah权限以读取此设置:

Effectively what your saying is please grant Elmah permission to read this setting:

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

这篇关于IIS 6盒上的Elmah的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆