Search code examples
c#console-applicationelmah

Elmah error logs show local env path while running on production server


I have a C# service application running on a production machine. The service's job is to sync with another API every 60 seconds. However recently some really bizarre errors started to show up.

The error message itself is pretty straightforward - failed entity validation. However the path of the file in which the error occurred is the one I'm using when developing locally.

So the server path of the app is "C:/CronJobs/AppName/.." (1), while my local path is "C:/Users/MyLocalUsername/Local/Source/Repos/.." (2).

So the issue is the production server is throwing some errors, and then says that the error occurred in files in "C:/Users/MyLocalUsername/Local/Source/Repos/..", and this location doesn't even exist on the production server, it exists only on my local machine.

I've checked the Host name logged in the database and it's certain that it's coming from the production server. The database itself is protected anyway so I don't even have direct access to it, I have to RDP to manage it.

I restarted the application and it still persists (no errors thrown while it was turned off though).

Can somebody give me any clue where to look to resolve this problem?


Solution

  • I believe that those parts are actually added at compile time on the building machine. If you have debug symbols enabled on your build, these will go the the production environment when you deploy.

    Look for PDB files on your production environment.