![](/img/trans.png)
[英]Use Web.config instead of app.config for integration test in ASP.NET MVC app
[英]WCF Client Implementation, is there way to keep services and end-point detail in class library app.config rather then web.config for ASP.NET MVC app
我有一個.NET項目,其中有APP.Client.Proxy類庫項目,負責為客戶端實現WCF,因此所有服務和端點配置詳細信息都存在,然后還有另一個使用這些服務的ASP.NET MVC項目。實施,即從控制器。 現在,如果我將服務和端點詳細信息放在類庫項目的app.config中,則它不起作用,抱怨找不到端點,但如果我將端點配置詳細信息放在MVC Web應用程序的web.config中就可以工作。
我的問題是,我可以將服務和端點詳細信息分別放在類庫中的app.config中,而不是web.config中
應用域在執行時使用一個配置文件。 而應用設置和連接字符串部分則允許分別引用外部文件和configSource。
快速瀏覽GoogleFu之后,我瀏覽了這兩篇文章
http://weblogs.asp.net/cibrax/configsource-attribute-on-system-servicemodel-section
問題的關鍵是您不能將其保留在類庫配置中,但仍可以將它們分離到外部配置文件中。
<configuration>
<!-- other code removed for brevity -->
<system.serviceModel>
<services configSource="Services.config" >
</services>
<bindings configSource="Bindings.config">
</bindings>
<behaviors configSource="Behaviors.config">
</behaviors>
</system.serviceModel>
<!-- other code removed for brevity -->
</configuration>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.