Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / June 2004

Tip: Looking for answers? Try searching our database.

GetExecutingAssembly().Location and DLL called by WebService

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Neil Macdonald [Intergraph] - 04 Jun 2004 07:31 GMT
I am attempting to load a file that is situated in the same directory as an assembly that is called via a webservice

string csfFilePath = System.Configuration.ConfigurationSettings.AppSettings["CSFFilePath"]
if(csfFilePath==null || csfFilePath.Length==0

csfFilePath=System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + @"\"

_csfFilePath=csfFilePath

The first line using System.Configuration returns null; This I have found out is because only exe's can use the .config files

However the GetExecutingAssembly().Location return
@"c:\windows\microsoft.net\framework\v1.1.4322\temporary asp.net files\coordinatesystemtransformation\5e89ae88\c379ab0\assembly\dl2\df021851\907b49ab_fb49c401\

Which I guess is where the webservice is executing

Perhaps I am going about this all the wrong way; I am running in debug and need to step through the assembly and ws code to test

Any advice would be much help..
------------------------------------------------------------------------------------------------------------
Neil Macdonal
Senior Software Enginee
IntelliWhere Product Development Centr

Intergraph Corporation (NASDAQ: INGR
Intergraph Mapping and Geospatial Solution
Level 3, 299 Coronation Drive, Milton QLD Australia
[MSFT] - 04 Jun 2004 09:35 GMT
Hi Neil,

GetExecutingAssembly() is also not for a web service. It will return a
temporary folder for web service to load referenced assemblies. To Get the
phisical location of your asxm file, you may try following code in your web
service:

Context.Server.MapPath(".")

And its referenced assemblies should be in this sub "bin" folder.

Luke
Microsoft Online Support

Signature

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Neil Macdonald [Intergraph] - 04 Jun 2004 10:51 GMT
yep, this works @ run time. How does this work @ debug

my project structure is

\solution\webserviceprojec
\solution\assemblyprojec

files are built to \solution\build (this is common to both projects, but only the assembly delivers files to here

I need to step through both the webservice and the referenced assembly (currently as a project reference

------------------------------------------------------------------------------------------------------------
Neil Macdonal
Senior Software Enginee
IntelliWhere Product Development Centr

Intergraph Corporation (NASDAQ: INGR
Intergraph Mapping and Geospatial Solution
Level 3, 299 Coronation Drive, Milton QLD Australia
[MSFT] - 07 Jun 2004 07:05 GMT
Hi Neil,

Please feel free to correct me if I have misunderstood this. Based on my
understanding, you are working with a web serivce project, and its asmx
file should be in a virtual diretory, its assembly file (dll) should be in
a "bin" folder. However, from your description, they are in
"\solution\build". Can you explain more on this?

Regards,

Luke
Microsoft Online Support

Signature

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Neil Macdonald [Intergraph] - 08 Jun 2004 04:51 GMT
- I have one solution containing both the DLL/Assembly and the WebServic
- When I call GetExecutingAssembly() in the DLL it gives me the ASP.NET temp directory not the directory of where the dll i
- Both project outputs are set t \Solution\Buil
- I need to load an xml .config file in the DLL on initialization this currently is in the \build directory, along with the compiled project output (dll
- I want to be able to step through the code in both the webservice and DLL and return the right results

I am sure it is a simple solution

------------------------------------------------------------------------------------------------------------
Neil Macdonal
Senior Software Enginee
IntelliWhere Product Development Centr

Intergraph Corporation (NASDAQ: INGR
Intergraph Mapping and Geospatial Solution
Level 3, 299 Coronation Drive, Milton QLD Australia
[MSFT] - 08 Jun 2004 08:01 GMT
Hi Neil,

If you just want get the DLL's path, you may try following code in the
Class library:

System.Reflection.Assembly.GetAssembly( this.GetType() ).CodeBase.ToString()

Luke
Microsoft Online Support

Signature

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.