0

I have a debug=true enabled deployment of my website on a server somewhere. When I open it in a browser on the server, I get a stacktrace for my errors. When I navigate to that page from another machine, I get squat. How do I enable the stacktraciness for remote machines?

EDIT

stacktrace:enter image description here

squat (as in diddly squat):enter image description here

TO RECREATE

Create a vanilla Single Page App in Visual Studio and migrate everything to your database, web deploy that to Windows Server server somewhere with debug=true, attempt to debug connection string woes, fail as browsing the site from localhost on the server gives different behavior than browsing the site from an external machine.

2

1 Answer 1

3

This feature is by design, so that the internals of your program don't get displayed to users - who might be frightened by them and think they have broken the internet - and malicious individuals who might use the information to try and hack at your data (e.g. if it exposes info about the database). It enables you instead to display a user-friendly error message of your choice.

However, if you want to override this feature in your non-live environments to make testing easier, modify your web config as follows, to set "customErrors" to "Off":

<system.web>
...
  <customErrors mode="Off"/>
...
</system.web>

More info is here: https://msdn.microsoft.com/en-gb/library/h0hfz6fc(v=vs.100).aspx

I would strongly advise you never to do this in a live environment. Instead, handle exceptions and log them to your server's event log, so you can trace any issues.

Sign up to request clarification or add additional context in comments.

3 Comments

I have two websites running on the server, one is available publicly, one is available on the internal network. I am using the internal network one for debugging, but I'd rather not have to RDP into the server to debug it. This is just what I needed, thanks much. Bonus points if there is an option to wrap this into my deployment process without having to add and delete lines every time...
use config transforms in Visual Studio. msdn.microsoft.com/en-us/library/dd465318(v=vs.100).aspx
Awesome. You get free (gratis) beer if you're ever in Atlanta.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.