PC Review Forums Newsgroups Microsoft DotNet Microsoft Dot NET Debuging ASP.NET application with VS 2008 and relative filenames

Reply

Debuging ASP.NET application with VS 2008 and relative filenames

 
Thread Tools Rate Thread
Old 25-05-2009, 03:07 PM   #1
blescouet
Guest
 
Posts: n/a
Default Debuging ASP.NET application with VS 2008 and relative filenames


Hi all,
In an ASP.NET application, I'm using NHibernate with an external
configuration file, located in the project directory. In my code, the
name of this file is given to NHibernate without path (relative name).
While debuging (with VS development Web Server), it throws a
FileNotFoundException, trying to load the file from C:\Program
Files\Microsoft Visual Studio 9.0\Common7\IDE\ as the base path, not
from project's base path.
My colleagues, with the same source, haven't any problem : the file is
loaded from the project path.
I suppose I have something different in the configuration of my VS, or
my computer. But what, and Where ? I haven't any idea.

B.L.
  Reply With Quote
Old 25-05-2009, 04:01 PM   #2
Mr. Arnold
Guest
 
Posts: n/a
Default Re: Debuging ASP.NET application with VS 2008 and relative filenames


"blescouet" <jaimep@slespourriels.fr> wrote in message
news:eRQ%23DlT3JHA.4272@TK2MSFTNGP06.phx.gbl...
> Hi all,
> In an ASP.NET application, I'm using NHibernate with an external
> configuration file, located in the project directory. In my code, the name
> of this file is given to NHibernate without path (relative name). While
> debuging (with VS development Web Server), it throws a
> FileNotFoundException, trying to load the file from C:\Program
> Files\Microsoft Visual Studio 9.0\Common7\IDE\ as the base path, not from
> project's base path.
> My colleagues, with the same source, haven't any problem : the file is
> loaded from the project path.
> I suppose I have something different in the configuration of my VS, or my
> computer. But what, and Where ? I haven't any idea.
>


In nine cases out of ten, that 'FileNotFoundException' usually means there
is a reference to a DLL, a DLL calling another DLL, and the called DLL is
not on the machine.


__________ Information from ESET NOD32 Antivirus, version of virus signature database 4101 (20090525) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com



  Reply With Quote
Old 25-05-2009, 04:01 PM   #3
Mr. Arnold
Guest
 
Posts: n/a
Default Re: Debuging ASP.NET application with VS 2008 and relative filenames


"blescouet" <jaimep@slespourriels.fr> wrote in message
news:eRQ%23DlT3JHA.4272@TK2MSFTNGP06.phx.gbl...
> Hi all,
> In an ASP.NET application, I'm using NHibernate with an external
> configuration file, located in the project directory. In my code, the name
> of this file is given to NHibernate without path (relative name). While
> debuging (with VS development Web Server), it throws a
> FileNotFoundException, trying to load the file from C:\Program
> Files\Microsoft Visual Studio 9.0\Common7\IDE\ as the base path, not from
> project's base path.
> My colleagues, with the same source, haven't any problem : the file is
> loaded from the project path.
> I suppose I have something different in the configuration of my VS, or my
> computer. But what, and Where ? I haven't any idea.
>


In nine cases out of ten, that 'FileNotFoundException' usually means there
is a reference to a DLL, a DLL calling another DLL, and the called DLL is
not on the machine.


__________ Information from ESET NOD32 Antivirus, version of virus signature database 4101 (20090525) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com



  Reply With Quote
Old 25-05-2009, 05:03 PM   #4
blescouet
Guest
 
Posts: n/a
Default Re: Debuging ASP.NET application with VS 2008 and relative filenames

Mr. Arnold a écrit :
>
>
> In nine cases out of ten, that 'FileNotFoundException' usually means
> there is a reference to a DLL, a DLL calling another DLL, and the called
> DLL is not on the machine.
>


So I'm the tenth case ! It's not about loading assemblies. I have an XML
file containing the NHibernante configuration. This file is placed in
the project's directory. In my code, I'm passing the file name to
NHibernate ("NHibernate.config"). And somewhere in his code, NHibernate
uses this file name to create an XmlTextReader instance. Inspecting the
BaseUri property of this instance gives "C:\Program Files\Microsoft
Visual Studio 9.0\Common7\IDE\NHibernate.config" when I'm expecting
"<site base directory>\NHibernate.config".

B.L.
  Reply With Quote
Old 25-05-2009, 05:03 PM   #5
blescouet
Guest
 
Posts: n/a
Default Re: Debuging ASP.NET application with VS 2008 and relative filenames

Mr. Arnold a écrit :
>
>
> In nine cases out of ten, that 'FileNotFoundException' usually means
> there is a reference to a DLL, a DLL calling another DLL, and the called
> DLL is not on the machine.
>


So I'm the tenth case ! It's not about loading assemblies. I have an XML
file containing the NHibernante configuration. This file is placed in
the project's directory. In my code, I'm passing the file name to
NHibernate ("NHibernate.config"). And somewhere in his code, NHibernate
uses this file name to create an XmlTextReader instance. Inspecting the
BaseUri property of this instance gives "C:\Program Files\Microsoft
Visual Studio 9.0\Common7\IDE\NHibernate.config" when I'm expecting
"<site base directory>\NHibernate.config".

B.L.
  Reply With Quote
Old 26-05-2009, 05:34 AM   #6
Jack Jackson
Guest
 
Posts: n/a
Default Re: Debuging ASP.NET application with VS 2008 and relative filenames

On Mon, 25 May 2009 17:03:58 +0200, blescouet
<jaimep@slespourriels.fr> wrote:

>Mr. Arnold a écrit :
>>
>>
>> In nine cases out of ten, that 'FileNotFoundException' usually means
>> there is a reference to a DLL, a DLL calling another DLL, and the called
>> DLL is not on the machine.
>>

>
>So I'm the tenth case ! It's not about loading assemblies. I have an XML
>file containing the NHibernante configuration. This file is placed in
>the project's directory. In my code, I'm passing the file name to
>NHibernate ("NHibernate.config"). And somewhere in his code, NHibernate
>uses this file name to create an XmlTextReader instance. Inspecting the
>BaseUri property of this instance gives "C:\Program Files\Microsoft
>Visual Studio 9.0\Common7\IDE\NHibernate.config" when I'm expecting
>"<site base directory>\NHibernate.config".
>
>B.L.


My understanding is that when you run a project in the IDE, it does
not run from the project directory, but an internal VS directory. I
have never been able to find anything that points to the true location
of the project.
  Reply With Quote
Old 26-05-2009, 05:34 AM   #7
Jack Jackson
Guest
 
Posts: n/a
Default Re: Debuging ASP.NET application with VS 2008 and relative filenames

On Mon, 25 May 2009 17:03:58 +0200, blescouet
<jaimep@slespourriels.fr> wrote:

>Mr. Arnold a écrit :
>>
>>
>> In nine cases out of ten, that 'FileNotFoundException' usually means
>> there is a reference to a DLL, a DLL calling another DLL, and the called
>> DLL is not on the machine.
>>

>
>So I'm the tenth case ! It's not about loading assemblies. I have an XML
>file containing the NHibernante configuration. This file is placed in
>the project's directory. In my code, I'm passing the file name to
>NHibernate ("NHibernate.config"). And somewhere in his code, NHibernate
>uses this file name to create an XmlTextReader instance. Inspecting the
>BaseUri property of this instance gives "C:\Program Files\Microsoft
>Visual Studio 9.0\Common7\IDE\NHibernate.config" when I'm expecting
>"<site base directory>\NHibernate.config".
>
>B.L.


My understanding is that when you run a project in the IDE, it does
not run from the project directory, but an internal VS directory. I
have never been able to find anything that points to the true location
of the project.
  Reply With Quote
Old 26-05-2009, 09:59 AM   #8
Andrew Morton
Guest
 
Posts: n/a
Default Re: Debuging ASP.NET application with VS 2008 and relative filenames

blescouet wrote:
> So I'm the tenth case ! It's not about loading assemblies. I have an
> XML file containing the NHibernante configuration. This file is
> placed in the project's directory. In my code, I'm passing the file
> name to NHibernate ("NHibernate.config").


Have you tried passing it Server.MapPath("~/NHibernate.config")?

Andrew


  Reply With Quote
Old 26-05-2009, 09:59 AM   #9
Andrew Morton
Guest
 
Posts: n/a
Default Re: Debuging ASP.NET application with VS 2008 and relative filenames

blescouet wrote:
> So I'm the tenth case ! It's not about loading assemblies. I have an
> XML file containing the NHibernante configuration. This file is
> placed in the project's directory. In my code, I'm passing the file
> name to NHibernate ("NHibernate.config").


Have you tried passing it Server.MapPath("~/NHibernate.config")?

Andrew


  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off