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
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
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.
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.
PDB files are for debugging, but you can leave them on the production server. Nothing bad will happen