.NET 2.0 App.Config connection strings includes unwanted SQLExpress default

后端 未结 1 1858
春和景丽
春和景丽 2021-01-14 06:32

I\'m using a connectionStrings section within an app.config file in a .NET 2.0 project. The config section contains two connection strings I have defined.

相关标签:
1条回答
  • 2021-01-14 07:20

    It's defined in machine.config. To get rid of it, use:

    <connectionStrings>
        <clear/>
        <add ... >
    </connectionStrings>
    

    As a general rule, sections that have <add> and <remove> elements (e.g. appSettings, connectionStrings and the provider configuration sections) also have a <clear> element, which you can use if you don't want to inherit elements from a higher level web.config or machine.config file.

    0 讨论(0)
提交回复
热议问题