简体   繁体   English

在IIS中托管时合并WCF服务库配置文件

[英]Consolidating WCF Service Library config files when hosting in IIS

I have a number of WCF Service Libraries that each have their own App.config. 我有许多WCF服务库,每个库都有自己的App.config。 I host these libraries in an ASP.Net project using serviceActivations / fileless. 我使用serviceActivations / fileless将这些库托管在ASP.Net项目中。 This ASP.Net project also has a web.config that is deployable. 此ASP.Net项目还具有可部署的web.config。

Developers have been updating the App.config but not updating the web.config which causes deployment issues. 开发人员一直在更新App.config,但没有更新导致部署问题的web.config。 To stop this from happening I thought I'd remove the App.Config's and centralize them to a single file. 为了阻止这种情况的发生,我想我将删除App.Config并将其集中到一个文件中。 If I was hosting the services in a windows service I could just point them all to the same App.Config, but asp.net uses a Web.config. 如果我将服务托管在Windows服务中,则可以将它们全部指向相同的App.Config,但是asp.net使用的是Web.config。

Is there any way to solve this? 有什么办法解决这个问题? It'd be nice if I could tell the service libraries to use the web.config, but some wizards such as the service reference wizard will create an App.Config file if it's not present. 如果可以告诉服务库使用web.config,那就太好了,但是某些向导(例如服务引用向导)会创建一个App.Config文件(如果不存在)。

It seems like you're looking for a technical solution (ie, some way to automate updating/using the Web.Config file vs the App.Config file), but I think you may gain more ground by process/training. 似乎您正在寻找一种技术解决方案(即,一种自动更新/使用Web.Config文件和App.Config文件的方法),但我认为您可能会通过过程/培训获得更多的基础。

You mention that developers are updating the App.config file, but not the Web.config - if that's the case, how are they unit testing their changes? 您提到开发人员正在更新App.config文件,而不是Web.config文件-如果是这种情况,他们将如何对更改进行单元测试? Since the libraries (if you're talking about DLLs) will never use their own App.config (or any config file, for that matter), the developers have to be updating the consuming application's config file. 由于这些库(如果您正在谈论DLL)将永远不会使用其自己的App.config(或任何配置文件),因此开发人员必须更新使用该应用程序的配置文件。

Why not sit down with the developers and work out a process (working with them vs handing down a process from above will get you a lot further) with them that includes updating the Web.config as part of their unit testing? 为什么不与开发人员坐下来制定一个流程(与他们合作而不是从上而下的流程将使您走得更远),其中包括更新Web.config作为其单元测试的一部分? It should be a fairly straight forward copy and paste of the relevant parts of the config file. 它应该是配置文件相关部分的直接复制和粘贴。

There is quite possibly a technological way to do what you're looking to do (if I understand your question correctly), but I do think a process rather than a technical solution would be worth trying. (如果我正确理解了您的问题),很可能有一种技术方法可以完成您想要做的事情,但是我确实认为值得尝试一种过程而不是一种技术解决方案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM