使用外部配置文件
<configuration> <configSections> <section name="glimpse" type="Glimpse.Core.Configuration.Section, Glimpse.Core" /> </configSections> <!--连接字符串--> <connectionStrings configSource="Config\connections.config" /> <!--app配置--> <appSettings configSource="Config\app.config" /> </configuration>
连接字符串:
<?xml version="1.0" encoding="utf-8"?> <connectionStrings> <add connectionString="Server=.;Database=cits;User ID=sa;Password=sa" name="DB" providerName="System.Data.SqlClient" /> </connectionStrings>
配置节点:
<?xml version="1.0" encoding="utf-8"?> <appSettings> <add key="ImgWebUrl" value="http://localhost:7246/" /> <add key="specialrole" value="1,5,11" /> <add key="SalesmanOfHuanQiu" value="12" /> <add key="FinanceOfHuanQiu" value="11" /> <add key="LogRootPath" value="D://wwwroot//admin_citssh_com//logfiles" /> </appSettings>