Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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.

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:

In <system.webServer>

<handlers>
  <add name="elmah" verb="GET" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah"/>
</handlers>

And in <system.web>

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

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.

Edit: 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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
203 views
Welcome To Ask or Share your Answers For Others

1 Answer

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 ;)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...