GetExecutingAssembly().Location and DLL called by WebService

Discussion in 'ASP .Net Web Services' started by Neil Macdonald [Intergraph], Jun 4, 2004.

  1. 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
     
    Neil Macdonald [Intergraph], Jun 4, 2004
    #1
    1. Advertising

  2. Neil Macdonald [Intergraph]

    [MSFT] Guest

    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

    Get Secure! www.microsoft.com/security
    (This posting is provided "AS IS", with no warranties, and confers no
    rights.)
     
    [MSFT], Jun 4, 2004
    #2
    1. Advertising

  3. 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
     
    Neil Macdonald [Intergraph], Jun 4, 2004
    #3
  4. Neil Macdonald [Intergraph]

    [MSFT] Guest

    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

    Get Secure! www.microsoft.com/security
    (This posting is provided "AS IS", with no warranties, and confers no
    rights.)
     
    [MSFT], Jun 7, 2004
    #4
  5. - 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
     
    Neil Macdonald [Intergraph], Jun 8, 2004
    #5
  6. Neil Macdonald [Intergraph]

    [MSFT] Guest

    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

    Get Secure! www.microsoft.com/security
    (This posting is provided "AS IS", with no warranties, and confers no
    rights.)
     
    [MSFT], Jun 8, 2004
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Anushi
    Replies:
    5
    Views:
    9,016
  2. Felix
    Replies:
    1
    Views:
    365
    Felix
    Sep 29, 2006
  3. H. Simpson
    Replies:
    4
    Views:
    351
    H. Simpson
    Aug 3, 2004
  4. saiho.yuen
    Replies:
    3
    Views:
    556
    kaeli
    Sep 14, 2004
  5. hehehe

    adf java and <location></location>

    hehehe, Jul 6, 2009, in forum: Javascript
    Replies:
    1
    Views:
    119
    Evertjan.
    Jul 6, 2009
Loading...

Share This Page