在 WCF 的单独项目中配置端点

Configuring endpoints in separate project in WCF

我需要将容器注册端点 (Windsor) 从 Global.asax 文件转移到新项目。我想从 Web.config 文件中检索定义端点的部分,但我不知道如何从单独的项目访问该文件和部分。我试过这样的事情:

 ClientSection clientSection = new MvcApplication().Application.Get((ClientSection) ConfigurationManager.GetSection("system.serviceModel/client"))

但它似乎是错误的路径。关于如何将一个项目中 Web.config 的部分复制到另一个项目的配置文件中有什么想法吗?

尝试使用此代码获取客户端部分:

ClientSection clientSection = 
ConfigurationManager.GetSection("system.serviceModel/client") as ClientSection;