3

When developing I understand why PDB files are build. But when I deploy my website for the production server the PDB files does still exists. I dont's understand why.

Should I delete them in production environment or leave them

Ruutert
  • 395
  • 1
  • 7
  • 18
  • Check out this question http://stackoverflow.com/questions/608002/do-you-have-to-deploy-the-pdb-file-with-compiling-under-release – Coral Doe Nov 01 '12 at 11:44

3 Answers3

8

The PDB files allow Stack Traces of your code to be logged when your application throws an Unhandled Exception.

If your website has CustomErrors in the web.config set to OFF then your erroring code will be visible to everybody. This is BAD.

If your website has CustomErrors in the web.config set to ON or RemoteOnly then your erroring code will not be visible to the public, however you will be able to find the StackTrace in the server Event Log and this may help you to track down errors in your code. This is OK.

If you delete the PDBs (or stop then from publishing via your project build/publish configuration) then your site will not log your code in your Stack Trace, however it will log other stack information. In any case, always set CustomErrors in the web.config to ON or RemoteOnly. Always Do this.

Robert
  • 3,276
  • 1
  • 17
  • 26
Jaimal Chohan
  • 8,530
  • 6
  • 43
  • 64
  • 2
    Exceptions will contain stack trace in either case, but with PDB files they will contain also line numbers. http://stackoverflow.com/questions/381537/deploying-pdb-files-in-iis-any-benefit?rq=1 – Robert Aug 20 '14 at 11:12
1

You can safely remove them. They are used for debugging and code source purposes.

If you don't want the pdb-files to be deployed then in your project settings (right-click the project and choose Properties > Build):

You can choose the Configuration: you are using for deploying (for example Release) and then in the Output section, press the Advanced..-button to open the Advanced Build Settings and set Debug Info: to none (usually it's pdb-only in Release-mode).

Then every time you are deploying in Release-mode the pdb-files won't be generated.

Mario S
  • 11,715
  • 24
  • 39
  • 47
  • so, PDB file is not nessecory? and we dont have to update them in server everytime we update DLL file? :-? – Moslem Hadi Feb 07 '13 at 12:57
  • @Reza Correct. The code will still work. I usually remove them and only add if I need to debug the production server =) – Mario S Feb 07 '13 at 13:02
0

PDB files are for debugging, but you can leave them on the production server. Nothing bad will happen

Mihai
  • 2,740
  • 31
  • 45