Why does .net mvc 4 web api service show the local machine path in an exception message?

Customization

I deployed the mvc 4 web api service to our web server using the web deployment method in Visual Studio 2010.

Problem

When an exception is thrown, it displays my local machine on which the service was created in the exception message.

Example:

... in System.Data.SqlClient.SqlConnection.Open () \ r \ n in ImageApp_REST_Services.Repositories.ImageLinkRepository.Get (String userId) in C: \ localuser \ documents \ visual studio 2010 \ Projects \ ImageApp_REST_Services \ ImageApp_REST_Services \ ImageLinkRepository.cs : line 57 \ r \ n

Does this mean that the service is running on my local machine?

or

Does it just carry over from the moment you deployed the website?

In any case, how can I fix this so that the web server on which the service is deployed appears in the exception message, and not on my local development machine?

Thanks!

+6
source share
2 answers

When you deploy an application, you usually deploy PDB files with it. PDB files contain debugging symbols that allow you to specify line numbers ... They are generated at the time you created / compiled the application for deployment / installation, so they refer to your local path.

PDB Information

+4
source

This means that you deployed your code under the debug build, or you accidentally deployed the PDB files with your deployment, because the runtime has access to debugging information that only the debugger usually cares about. The path information refers to the machine on which the assembly was performed or where the PDB files were copied.

+1
source

Source: https://habr.com/ru/post/952845/


All Articles