Search code examples
asp.net-mvcwcfcastle-windsor

Configuring endpoints in separate project in WCF


I need to shift container registering endpoints (Windsor) from Global.asax file to new project. I'd like to retrieve a section from Web.config file where endpoints are defined but I don't know how to reach that file and section from separate project. I have tried something like this:

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

but it seems it is wrong path. Any ideas how to copy section from Web.config in one project into configuration file in another?


Solution

  • Try this code to get client section:

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