不能与ELMAH MVC访问生产服务器上/ ELMAH? [英] Can't access /elmah on production server with Elmah MVC?
问题描述
我安装了elmah.mvc的NuGet包,并保持了SAN的默认配置设置发送电子邮件,并将其插入到一个SQL数据库。
I installed the elmah.mvc nuget package and kept the default configuration of that sans setting up sending an email and plugging it into a SQL database.
在我的本地机器,当我使用Visual Studio的主机,我可以打开我的应用程序和访问/ ELMAH蛮好看的错误的报告。然而,当我尝试和生产准入/ ELMAH,我得到两个错误,首先,我收到了 403访问被拒绝
服务器错误。然后在我的电子邮件(从ELMAH)我得到:
On my local machine when I use the Visual Studio host, I can open my app and access /elmah fine to see a report of the errors. However, when I try and access /elmah on production, I get two errors, first I get a 403 access is denied
server error. Then in my email (from elmah) I get:
System.Web.HttpException: Server cannot set status after HTTP headers have been sent.
任何人都知道是怎么回事,如何解决?谢谢你。
Anyone know what is going on here and how to fix? Thanks.
我尝试了以下迄今为止低于答案的建议:
I tried the following so far as suggested by the answers below:
在< system.webServer>
<handlers>
<add name="elmah" verb="GET" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah"/>
</handlers>
而在&LT;&的System.Web GT;
<httpHandlers>
<add verb="POST,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah" />
</httpHandlers>
我试过设置的路径,既 elmah.axd
,简单地〜/ ELMAH
。所有仍给了相同的错误,仍然在当地工作,但不是在生产。
I tried setting the path to both elmah.axd
and simply ~/elmah
. All still give the same error, and still works locally, but not in production.
编辑:实际上,当我远程登录到服务器,并通过浏览器访问它在那里(不使用本地主机,但实际的网站地址)也适用。那么,允许我在没有?好像它在服务器级别。
It actually also works when I remote into the server and access it via browser on there (not using localhost, but the actual site address). So what permission am I not having? Seems like it's at the server level.
推荐答案
您需要通过添加下面的配置设置为&LT启用ELMAH远程访问; ELMAH&GT;
在web.config文件部分。的默认设置这个值是假的,只允许本地主机,因此为什么它是工作在本地计算机上从Visual Studio中。
You need to enable Elmah for remote access by adding the following configuration setting to the <elmah>
section in your web.config file. The default setting for this value is false, which only allows localhost, hence why it is working on your local machine from within Visual Studio.
<elmah>
<security allowRemoteAccess="true"/>
</elmah>
我好像总是这个忘了自己,花几分钟抓我的头;)
I always seem to forget this myself and spend a few minutes scratching my head ;)
这篇关于不能与ELMAH MVC访问生产服务器上/ ELMAH?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!