相关疑难解决方法(0)

使用Visual Studio web.config转换进行调试

可能重复:
如何在内置的visual studio调试器服务器中使用Web.debug.config?

我想使用Web.config转换,该转换适用于发布也适用于调试.

当我发布Web应用程序时,Visual Studio会根据我的currenctbuild配置自动转换Web.config.当我开始调试时,如何告诉Visual Studio执行相同的操作?在调试启动时,它只使用默认的Web.config而不进行转换.

任何的想法?

asp.net web-config visual-studio visual-studio-publish

156
推荐指数
5
解决办法
8万
查看次数

75
推荐指数
3
解决办法
3万
查看次数

app.config:如何使一个名为appSettings的嵌套customSection成为ConfigurationManager.AppSettings

我想要的app.config是这样的:

<configSections>
        <sectionGroup name="QA_Environment">
            <section name="databases" type="System.Configuration.NameValueSectionHandler"/>
            <section name="storageSystems" type="System.Configuration.NameValueSectionHandler"/>
        </sectionGroup>
        <sectionGroup name="Production_Environment">
            <section name="databases" type="System.Configuration.NameValueSectionHandler"/>
            <section name="storageSystems" type="System.Configuration.NameValueSectionHandler"/>
        </sectionGroup>
    </configSections>
Run Code Online (Sandbox Code Playgroud)

...然后我就得到了正确的组和部分.但是我会对任何有效或更好的建议感到满意.我现在已经降低了我的愿望:

    <configSections>
    <sectionGroup name="QA_Environment">
        <section name="appSettings" type="System.Configuration.NameValueSectionHandler"/>
    </sectionGroup>
    <sectionGroup name="Production_Environment">
        <section name="appSettings" type="System.Configuration.NameValueSectionHandler"/>
    </sectionGroup>
</configSections>
Run Code Online (Sandbox Code Playgroud)

我想这很好......我想知道的主要问题是,如果我可以将这些部分中的一个替换为根级别的appSettings ...而不必迭代它们并以编程方式添加或创建配置并保存它.我只希望用户能够选择一个环境,select事件将改变appSettings ...

我面临的一个限制是我引用的数据层需要保持原样....所以我基本上需要让我的app.config可以像目前这些其他项目一样访问......那就是ConfigurationManager.AppSettings [afdasdf]

如果需要澄清,请告诉我...谢谢

c# configurationmanager app-config appsettings custom-sections

6
推荐指数
1
解决办法
9099
查看次数