ELMAH在本地计算机上工作,但不在生产中工作 [英] ELMAH works on local machine, but not on production

查看:73
本文介绍了ELMAH在本地计算机上工作,但不在生产中工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

设置简单,我正在使用ELMAH记录异常并向我发送电子邮件.一切在我的本地计算机上都可以正常运行,但是当我在生产服务器上进行更改时,不会记录错误,也不会收到电子邮件.

Simple set up, I'm using ELMAH to log exceptions and send me e-mails. Everything works fine on my local machine, but when I put the changes on my production server, errors don't get logged and I don't get e-mails.

这是我在本地计算机上的web.config:

Here's my web.config on my local machine:

<?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" />
            <section name="errorFilter" requirePermission="false"
                type="Elmah.ErrorFilterSectionHandler, Elmah" />
        </sectionGroup>
    </configSections>

    <elmah>
        <security allowRemoteAccess="0" />
        <errorLog type="Elmah.SqlErrorLog, Elmah"
            connectionStringName="MyDB" />
        <errorMail from="errors@mysite.com" to="myemail@mysite.com"
            subject="Error" smtpServer="localhost" smtpPort="25" 
            userName="user@mysite.com" password="mypassword" />
    </elmah>

    <connectionStrings>
        <add name="MyDB" connectionString="Data Source=.\SQLEXPRESS
            AttachDbFilename=|DataDirectory|\MyDB.mdf;
            Integrated Security=True;User Instance=True;
            MultipleActiveResultSets=True"
            providerName="System.Data.SqlClient" />
        <!--<add name="MyDB" connectionString="Server=mysite.com;
            Database=MyDB;User ID=user;Password=mypassword;
            Trusted_Connection=True;Integrated Security=False;
            MultipleActiveResultSets=True"
            providerName="System.Data.SqlClient" />-->
    </connectionStrings>

    <system.web>  
        <!--<httpHandlers>
            <add verb="POST,GET,HEAD" path="elmah.axd" 
                type="Elmah.ErrorLogPageFactory, Elmah" />
        </httpHandlers>-->
        <httpModules>
            <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" />
            <add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah" />
            <add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" />
        </httpModules>
    </system.web>

    <location path="Admin/Errors">
        <system.web>
            <httpHandlers>
                <add verb="POST,GET,HEAD" path="elmah.axd"
                    type="Elmah.ErrorLogPageFactory, Elmah" />
            </httpHandlers>
        </system.web>
    </location>
</configuration>

在我的机器上和生产上的web.config之间唯一的区别是所使用的连接字符串.在我的机器上,我正在连接到.mdf文件.在生产中,我正在连接到外部数据库.

The only difference between the web.config on my machine and on production is the connection string being used. On my machine, I'm connecting to a .mdf file. On production, I'm connecting to an external database.

有人可以在这里看到我在做什么吗?

Can anyone see what I'm doing wrong here?

我正在使用C#和ASP.NET MVC 3

I'm using C# and ASP.NET MVC 3

推荐答案

您需要为远程访问设置allowRemoteAccess ="yes".

You need to set allowRemoteAccess ="yes" for remote access.

  <elmah>
    <security allowRemoteAccess="yes"/>
  </elmah>

然后查看elmah管理员页面,看看是否有帮助.

And check the elmah admin page to see if that helps you.

示例访问: http://prodserver/elmah.axd

这篇关于ELMAH在本地计算机上工作,但不在生产中工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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