告诉 appcmd 将配置写入 applicationhost.config 而不是站点的 web.config

问题描述

由于我understand it,可以在以下文件中将连接字符串和其他配置对象添加到站点的范围 -

  1. machine.config
  2. applicationhost.config
  3. 网站的 web.config

我正在运行以下命令 -
APPCMD set config "site1" /section:ConnectionStrings /+"[ConnectionString='Data Source=localhost;Integrated Security=SSPI;',Name='Northwind',providerName='System.Data.SqlClient']"

这会在 web.config 文件中添加一个元素。
我想在 applicationHost.config 文件中看到它。

我尝试在 元素下手动添加 -

        <site name=...
             <connectionStrings>
                 <add connectionString="Data Source=localhost;Integrated Security=SSPI;" name="fromApplicatinoHost" providerName="System.Data.SqlClient " />
             </connectionStrings>
        </site>

但这不是 applicationHost 的合法语法。
那么如何将 connectionString 添加到 applicationHost ?

谢谢,

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...