"全局元素'配置'已经声明"在web配置 [英] "Global element 'configuration' has already been declared" in web config

查看:995
本文介绍了"全局元素'配置'已经声明"在web配置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到我的web配置一个恼人的构建警告。我有大约40警告全局元素{元素名称}已经声明的在我的web配置中的所有元素。这是一个WCF服务,我创造了同一个解决方案作为一个MVC的网站。我怀疑的问题是,WCF服务引用MVC组件(反映一些元数据),并在某种程度上被纳入导致重复的项目这两个网络配置文件。搜索比我有一个只打开了不同的问题。

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.

这篇关于"全局元素'配置'已经声明"在web配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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