1

probably this is an easy one. I have a solution that contains two projects:

  • a web page (asp.net)
  • a project that contains logic (Project B)

I am set up the web in a server and it loads ok, but when it needs to use the Project B I get an exception showing that it is searching a class in the path of the machine where the code was compiled. This image is the exception I am getting (in orange the path of the compilation machine): enter image description here How can I configure the web in order to tell where to search the files of Project B?

Really appreciate any help

Ignacio Gómez
  • 1,587
  • 4
  • 23
  • 41
  • possible duplicate of [Do not show file paths in stack trace C#](http://stackoverflow.com/questions/2139263/do-not-show-file-paths-in-stack-trace-c-sharp) – Matías Fidemraizer Jul 29 '15 at 18:14
  • It probably shows you that path because this is where the debug symbols were generated. Your problem looks like a database connection issue. – Nikolai Samteladze Jul 29 '15 at 18:17

2 Answers2

2

I get an exception showing that it is searching a class in the path of the machine where the code was compiled.

Wrong! C# compiles to intermediate language (IL) and this last one is the executable code which is also compiled to machine code using the JIT compiler or NGen-ing the IL..

You find that class file path because you're publishing your Web app using the Debug configuration and you're also including the .pdb files.

While I find that part of your question is a possible duplicate (see my close vote comment in the question itself), I wanted to add an answer to demystify your statement:

How can I configure the web in order to tell where to search the files of Project B?

In .NET, executable code is compiled into assemblies, either executable or dynamically-linked libraries (DLL). That is, these class paths to your actual code location in your machine are just debugging information to make your life easier when looking and finding issues during some execution call stack.

Matías Fidemraizer
  • 63,804
  • 18
  • 124
  • 206
  • So the problem should be solved by compiling in release, right? – Ignacio Gómez Jul 29 '15 at 18:44
  • @nachogsiri For example... BTW, the SQL server connectivity issue won't be solved, you know. But if you're looking for avoiding the exposure of your dev machine source code location.... release should do the trick ;) – Matías Fidemraizer Jul 29 '15 at 18:52
  • @nachogsiri If the problem is the SQL thing, you should ask another question, but you should also use the Q&A search here in StackOverflow because SQL Server issues have been asked tons of times...! – Matías Fidemraizer Jul 29 '15 at 18:53
0

The files names are from whatever machine the .pdb file for your assembly was generated on.

From MSDN:

A program database (PDB) file holds debugging and project state information that allows incremental linking of a Debug configuration of your program

Your problem looks like a database connection issue (which is explicitly said in the exception). Please check your connection string and make sure that your database is accessible.

Nikolai Samteladze
  • 7,699
  • 6
  • 44
  • 70