Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Webservice Web.Config

Options
  • 10-01-2011 5:51pm
    #1
    Registered Users Posts: 3,492 ✭✭✭


    I have a webservice, coded in C#, that has its own web.config file that contains appSettings for the Service. We will call the webservice "PerformTask".

    This Webservice has it's own Installer editor and the Installation has custom screens. This allows the User installing the webservice to enter in specific information that gets saved to the web.config file during the installation process.

    These appSettings are then accessed during runtime.

    The problem I have is around opening the Config File.

    The code I am using is:
    System.Configuration.Configuration config = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("/PerformTask");

    The issue I am getting is, if the User decides to alter the name of the virtual directory during the installation, or manually in IIS, to "PerformTask1" the above line of code no longer works.

    I have tried using null, but this points to the root web.config.
    I have tried "/" and "~" but with no luck.

    Can anyone shed some light on possible solutions please?


Comments

  • Registered Users Posts: 1,266 ✭✭✭Overflow


    Why don't you just store the configuration for the installation somewhere else, DB or another config file.


Advertisement