none
How to specify Base Directory in the app.config file in wcf? RRS feed

  • Question

  • I want  to put some files (say at location c:\data\xyz.html).

    I want to know how can we specify such location in the app.config file?

    And also, how can I access it from a client machine (like :

    http:\\ipAddress:portNumber\xyz.html) ?

    Thank you.

    Tuesday, May 22, 2012 4:42 AM

Answers

  • Hi Kanhaiya Choudhary,

     as with shared folders we always starts with \\, for example i had a folder called "shared" and now i want to share it and made this folder as a shared folder now my path will be, \\<systemname>\shared, this way every client can have a access (with in its domain network).

      <appSettings>
        <add key="filename" value="\\ChoudharySystem\\Shared\\xyz.html"/>
      </appSettings>

    this way you can mention in the app.config..


    Sai Kumar K (MCP)
    Blog: Sai's Stuff.
    WebSite: SantoshTechnologies.
    MCP ID:Microsoft Transcript.

    Tuesday, May 22, 2012 7:01 AM

All replies

  • Hi,

    we have two options 

    1. You can have a shared folder with read access, so that it can access from all your client places, and give it the sharepath in app.config file.
    2. Having a relative path so that you can build the absolute path as per your requirement.

    Hope it will help you..


    Sai Kumar K (MCP)
    Blog: Sai's Stuff.
    WebSite: SantoshTechnologies.
    MCP ID:Microsoft Transcript.

    Tuesday, May 22, 2012 5:51 AM
  • Thank you Mr. Sai for replying. 

    But how do we exactly add it in the app.config file?

    I mean how can I specify that this is the shared folder in the config file and then how the service will know it has to route the request to this shared folder?

    Thank you.

    Tuesday, May 22, 2012 6:54 AM
  • Hi Kanhaiya Choudhary,

     as with shared folders we always starts with \\, for example i had a folder called "shared" and now i want to share it and made this folder as a shared folder now my path will be, \\<systemname>\shared, this way every client can have a access (with in its domain network).

      <appSettings>
        <add key="filename" value="\\ChoudharySystem\\Shared\\xyz.html"/>
      </appSettings>

    this way you can mention in the app.config..


    Sai Kumar K (MCP)
    Blog: Sai's Stuff.
    WebSite: SantoshTechnologies.
    MCP ID:Microsoft Transcript.

    Tuesday, May 22, 2012 7:01 AM