Azure-based MVC site returns error accessing elmah

I have an MVC WebAPI site that has the latest ELMAH.MVC NuGet package installed. In Visual Studio, I can access

http://localhost:1234/elmah 

and get the error log, as I should.

When I deploy it to Azure, it causes an error when I do this. Fortunately, Elmah logs an error in the XmlError log in App_Data, and I found this:

 <error errorId="92ad3ee1-3fd5-449a-8cb4-0474aa771aab" application="/LM/W3SVC/417796901/ROOT" host="RD00155D430783" type="System.Web.HttpException" message="Server cannot set status after HTTP headers have been sent." source="System.Web" detail="System.Web.HttpException (0x80004005): Server cannot set status after HTTP headers have been sent.&#xD;&#xA; 

And then they continue for many stack trace lines, NONE of which are approaching my code.

What's happening? I just added the Elmah.MVC nuget package and made the following changes to Web.Config

  <elmah> <security allowRemoteAccess="yes"/> <errorLog type="Elmah.XmlFileErrorLog, Elmah" logPath="~/App_Data" /> </elmah> <location path="elmah.axd"> <system.web> <allow roles="*" /> </system.web> </location> 

It never comes close to any of my controllers, so I cannot control when the HTTP status headers are set or sent.

Thanks for any help.

+4
source share
2 answers

itanex is right! Place an empty text file (i.e. placeholder.txt) in the App_Data folder and mark it as "Content" and "Always copy" - this will ensure the creation of the App_Data folder. Also, as Simon points out, the correct path (based on your configuration) is / elmah.axd

0
source

via fooobar.com/questions/104501 / ... :

Allow remote access:

 <elmah> <security allowRemoteAccess="true"/> </elmah> 
0
source

All Articles