2015-10-14 23 views
0

我需要將容器註冊端點(Windsor)從Global.asax文件轉移到新項目。我想從Web.config文件中檢索端點已定義的部分,但我不知道如何從separete項目訪問該文件和部分。我試過這樣的事情:在WCF中單獨項目中配置端點

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

但它似乎是錯誤的路徑。任何想法如何將一個項目中的Web.config部分複製到另一個項目中的配置文件中?

+0

http://stackoverflow.com/questions/19589/loading-system-servicemodel-configuration-section-using-configurationmanager – Shetty

+0

什麼類型的項目是這樣的「新項目」? Web應用程序?班級圖書館? –

回答

0

試試這個代碼來獲取客戶端部分:

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

但是如何在這裏引用MVC或frm mvc。在mvc global.asax中,我嘗試使用smtg:_container = new WindsorContainer()。Install(FromAssembly.Named(「Proj.Apllication.Ioc」))但是由於循環依賴性,我不能添加此引用? – arth81

+0

溫莎不專家:)這工作正常,當我嘗試在我的代碼asp.net代碼 – Shetty