![](/img/trans.png)
[英]Could not find default endpoint element that references contract - Hosting wcf
[英]Could not find default endpoint element that references contract in WCF
我已經有了mvc Web項目,並添加了另一個空項目,該項目包含所有類似於存儲庫的服務。
所以我有一個問題,它引發錯誤,即使我在Web.config中添加了綁定,我也無法弄清楚為什么。
錯誤:
在ServiceModel客戶端配置部分中找不到引用合同'DataService.ISDService'的默認終結點元素。 這可能是因為找不到您的應用程序的配置文件,或者是因為在客戶端元素中找不到與該協定匹配的端點元素。
App.config中:
<configuration>
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="SDEndPoint" />
</wsHttpBinding>
</bindings>
<client>
<endpoint address="http://services.local.com/Api.svc/wsHttp"
binding="wsHttpBinding" bindingConfiguration="SDEndPoint"
contract="ImageService.ISDService" name="SDEndPoint">
<identity>
<userPrincipalName value="nyc\pc" />
</identity>
</endpoint>
</client>
</system.serviceModel>
</configuration>
Web.config文件:
<client>
<endpoint address="http://services.local.com/Api.svc/wsHttp" binding="wsHttpBinding" bindingConfiguration="SDEndPoint" contract="ImageService.ISDService" name="SDEndPoint">
<identity>
<userPrincipalName value="nyc\pc" />
</identity>
</endpoint>
</client>
我不知道我要去哪里。
為了使其正常工作,您必須將所有內容都移到Web.config上,因為托管該服務的是Web應用程序。
為了解決您的問題,調用項目的服務必須具有相同的配置。 只需將<System.ServiecModel />
部分復制到您的網站Webconfig中。 另外,您可能需要在存儲庫中復制相同的設置。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.