关于日志管理Elmah的使用(我这里只谈Access的)

Elmah的优点我这里就不多说了。我只说他的配置吧

1.下载dll。地址是:http://elmah.googlecode.com/files/ELMAH-1.2-bin-x86.zip

2.下载完毕解压后,可以先运行根目录的demo.cmd。这样的话,系统在本机会先运行起来。看看效果。呵呵

3.打开http://code.google.com/p/elmah/  ,点击Microsoft Access (AccessErrorLog)  ,转入另外一个也没,点击该页面中的mkmdb.vbs。下载下来,可以用它来直接生成access数据库。

4.在dos中运行mkmdb就会在该目录下生成一个access数据库。

5.把该数据库放入到App_data文件夹下。微笑为了安全起见,重新命名一下。(把后缀名改为asp,asa ,获取在前面文件名前面加入#。等等。文件的名称弄长的)

6.把下载的ELMAH-1.2-bin-x86中bin下的dll拷贝到你的dll种。(根据你的版本)

7.下面就是web.config的配置了。其中红色的是我添加的。

 

<?xml version="1.0"?>
 <configuration>
<configSections>
        <sectionGroup name="elmah">
            <section name="security" requirePermission="false" type="Elmah.SecuritySectionHandler, Elmah"/>
            <section name="errorLog" requirePermission="false" type="Elmah.ErrorLogSectionHandler, Elmah"/>
            <section name="errorMail" requirePermission="false" type="Elmah.ErrorMailSectionHandler, Elmah"/>
        </sectionGroup>
    </configSections>
    <elmah>
        <errorLog type="Elmah.AccessErrorLog, Elmah" connectionStringName="ELMAH.Access" />
        <errorMail from="
noreply@example.com" to="elmah@example.com" priority="high" />
 <security allowRemoteAccess="1" /> 
    </elmah>

  <connectionStrings>
    
  <add name="ELMAH.Access" connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|Elmah.mdb" />
 </connectionStrings>
 <system.web>
   <httpModules>
 <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" />

</httpModules>
 <httpHandlers>
 
  <add verb="POST,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah" />
  </httpHandlers>

 

 </system.web>

<location path="elmah.axd">
 <system.web>
   <authorization>
  <deny users="?" />
  </authorization>
  </system.web>
  </location>

</configuration>
配置完毕之后,如果想看你就可以打开地址:
http://server/elmah.axd就可以查看了。需要注意的是:如果你是部署在服务器上。

如果网站的服务器是Window2003 则要对路径有写入权限(IIs_wpg)

另外查看的时候会提示你输入用户名和密码。

参考地址:

安全:ASP.NET保安系列 - 關於elmah.axd的安全設定 
配置:
net系统错误记录工具 Elmah

下载地址和说明。这个必须要看一下。

 

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值