发布后,将app.config中的appsettings添加到web.config [英] Adding appsettings from app.config to web.config after publishing

查看:161
本文介绍了发布后,将app.config中的appsettings添加到web.config的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有2个项目和Web应用程序的解决方案。 
我的appsettings添加到app.config中,该app.config存在于其中一个项目中。
然后我发布了webapplication。

但是当我在测试服务器中部署已发布的文件夹时,appsettings丢失,需要添加我从互联网上读取的...当我尝试在网络中添加我的appsettings时。 config(发布Web.config),并运行应用程序,我得到500服务器内部错误

app.config:

<? xml version = 1.0 编码 = utf-8 >
< configuration >
< applicationSettings >
.......
< / applicationSettings >
< / configuration >

web.config:
<? xml version = 1.0 >
< configuration < span class =code-keyword>>
< configSections >
< section name = error1 type = test,test1,Version = 1.0.1.3,Culture = neutral,PublicKeyToken = 77d9ae8727c9ec66 / >
< section name = error2 type = test2,test3,Version = 1.0.0.0,Culture = neutral,PublicKeyToken = 77d9ae8727c9ec66 / >
< / configSections >

如果我在此处添加应用设置,则会收到错误
< applicationSettings >
.......
< / applicationSettings >
< / configuration >


你能帮帮我吗?

解决方案

试试

<的AppSettings>< /&的AppSettings GT; 


I have solution with 2 projects and web application.
And my appsettings are added in app.config which is present in one of the project.
And then I published the webapplication.

But when i deploy the published folder in the test server, the appsettings are missing and that need to be added which I read from internet...And when I try to add my appsettings in the web.config(Published Web.config),and run the application, I am getting 500 server Internal error

app.config:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<applicationSettings>
.......
</applicationSettings>
</configuration>

web.config:
<?xml version="1.0"?>
<configuration>
  <configSections>
    <section name="error1" type="test, test1, Version=1.0.1.3, Culture=neutral, PublicKeyToken=77d9ae8727c9ec66"/>
    <section name="error2" type="test2,test3, Version=1.0.0.0, Culture=neutral, PublicKeyToken=77d9ae8727c9ec66"/>
  </configSections>

"If i add app setting here I am getting error"
<applicationSettings>
.......
</applicationSettings>
</configuration>


Can you please help me with this?

解决方案

try

<appsettings></appsettings>


这篇关于发布后,将app.config中的appsettings添加到web.config的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆