简体   繁体   English

ELMAH 适用于本地机器,但不适用于生产

[英]ELMAH works on local machine, but not on production

Simple set up, I'm using ELMAH to log exceptions and send me e-mails.设置简单,我使用 ELMAH 记录异常并向我发送电子邮件。 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.在我的本地计算机上一切正常,但是当我将更改放在生产服务器上时,不会记录错误,也不会收到电子邮件。

Here's my web.config on my local machine:这是我本地机器上的 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" />
            <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>

The only difference between the web.config on my machine and on production is the connection string being used.我的机器上和生产上的 web.config 之间的唯一区别是使用的连接字符串。 On my machine, I'm connecting to a.mdf file.在我的机器上,我正在连接到一个 .mdf 文件。 On production, I'm connecting to an external database.在生产中,我正在连接到外部数据库。

Can anyone see what I'm doing wrong here?谁能看到我在这里做错了什么?

I'm using C# and ASP.NET MVC 3我正在使用 C# 和 ASP.NET MVC 3

You need to set allowRemoteAccess ="yes" for remote access.您需要设置 allowRemoteAccess ="yes" 进行远程访问。

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

And check the elmah admin page to see if that helps you.并检查 elmah 管理页面,看看是否对您有帮助。

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

Are you running IIS7 in production?你在生产中运行 IIS7 吗? Read my answer to a similar question here Elmah, convert to.Net4 vs2010, run on server 2008, does not work在这里阅读我对类似问题的回答Elmah, convert to.Net4 vs2010, run on server 2008, doesn't work

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Elmah在生产时给出错误代码500,但在旧主机/本地开发中却给出错误代码500 - Elmah giving error code 500 on production, but not on old host/local development 无法为具有“...”权限的 SSL/TLS 建立安全通道,但在代码中设置了 TLS。 在本地机器上工作正常,但在生产中不行 - Could not establish secure channel for SSL/TLS with authority “…” but TLS is set in the code. Works fine on local machine but not in Production ELMAH YSOD投入生产 - ELMAH YSOD in production 代码在本地机器上工作,但在 IIS 上不工作 - Code Works On Local Machine But Not On IIS Elmah错误日志在生产服务器上运行时显示本地环境路径 - Elmah error logs show local env path while running on production server ELMAH-在生产环境中未收到电子邮件 - ELMAH - Email not received in production environment MS Access Connection在本地工作,但在生产环境中不工作 - MS Access Connection works in local but not working in production NetworkCredential可在本地计算机上工作,但不能在生产服务器上工作 - NetworkCredential works in local computer but not production server 以下内容在本地主机上进行开发,但在生产中不起作用 - The following works in development on a local host but in production does not 种子方法在本地计算机上有效,但无法使用 - seed method works in local machine but not appharbor
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM