If app.config for a DLL should be in the “main config”… what do we do with WCF References in DLLs?

吃可爱长大的小学妹 提交于 2019-11-30 05:15:29

Yes. Copy and paste is the answer. It's not a great answer, but it's the answer, and it has been since day 1 in .NET 1.0 with AppSettings.

You can have a library project include custom config files and those files can be copied to the executable location of another application (it's a little sticky, but not too big a deal). You just have to use OpenMappedExeConfiguration to get to any information in those files. You'd then have to do some custom coding when you instantiate your WCF proxies (instantiate a Binding and pass that to the proxy). I'm late to the party here, but I can provide more details if you're interested.

No you're right.

But surely your WCF services are not in the business layer project, but instead in a separate project which acts as a facade into the business layer. Your business layer is then just another assembly as it should be and doesn't care how it's accessed, the WCF project does that for it.

Or of course you write custom service hosts and put the minimal amount of information in the config file (host name, certificate thumbprint) and do the rest in code.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!