& quot;全局元素'配置'已经被宣布为“& quot;在网络配置中 [英] "Global element 'configuration' has already been declared" in web config

查看:81
本文介绍了& quot;全局元素'配置'已经被宣布为“& quot;在网络配置中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的Web配置中收到令人讨厌的构建警告.对于我的Web配置中的所有元素,我已经声明了全局元素'{element name}'的大约40条警告.这是针对我在与MVC网站相同的解决方案中创建的WCF服务的.我怀疑问题在于WCF服务引用了MVC程序集(以反映某些元数据),并且以某种方式包含了两个Web配置文件,从而导致重复项.搜索只会发现与我遇到的问题不同的问题.

I am getting an annoying build warning in my web config. I have about 40 warnings of Global element '{element name}' has already been declared for all the elements in my web config. This is for a WCF service I am creating in the same solution as an MVC website. I suspect that the issue is that the WCF service references the MVC assembly (to reflect some metadata), and both web config files are somehow being included resulting in duplicate items. Searching has only turned up different issues than the one I am having.

是否可以通过告诉配置管理器忽略引用的MVC程序集中的配置文件来解决此问题?

Is there any way to fix this issue, perhaps by telling the configuration manager to ignore the config file in the referenced MVC assembly?

在尝试尽可能分离我的不同依赖项时,关闭计算机后我的警告消息消失了.

While trying to separate my different dependencies as much as possible, my warning messages went away after shutting down the computer.

推荐答案

将服务与主机分开.IE或多或少具有纯粹的程序集服务,然后分别从控制台主机,wcf主机,Windows服务主机和mvc主机项目中引用该服务.

Separate your service from your host. IE have your service in a more or less pure assembly and then reference that from your console host, your wcf host, your windows service host and your mvc host projects separately.

这篇关于& quot;全局元素'配置'已经被宣布为“& quot;在网络配置中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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