[英]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.