it:ad:nconfig:howto:configure_within_websites

IT:AD:NConfig:HowTo:Configure within WebSites

For one, you can't ../../ yourself out the top of the website (so you can't share one file between front/back servers)

But that's actually good practice (you don't want the back server's connection string to be shared out in the front server, do you?)

Secondly your machineName.app.config file must not be Added to the project. Again, that's a good thing. You don't want your dev config files to end up on the production servers.

Thirdly…if your site is within a VDir, append the VDir to the front of the path:


//If the VDir is BackNSI, then:


            string[] possiblePaths = new string[]
                {
                    "BackNSI\\Config\\MachineSpecificSettings\\app.config",
                };

            try
            {
                NConfigurator.UsingFiles(possiblePaths).SetAsSystemDefault();
            }
            catch (System.Exception e)
            {
                ITracingService tracingService = XAct.Shortcuts.ServiceLocate<ITracingService>();
                tracingService.TraceException(TraceLevel.Error, e,"Could not handle NConfig references.");
            }

            string check = System.Configuration.ConfigurationManager.AppSettings["NConfig"];

  • /home/skysigal/public_html/data/pages/it/ad/nconfig/howto/configure_within_websites.txt
  • Last modified: 2023/11/04 01:50
  • by 127.0.0.1