【发布时间】:2015-07-01 23:15:53
【问题描述】:
我有 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>
我不知道哪里出错了。
【问题讨论】:
-
> 我有一个 mvc web 项目,并且我添加了另一个空项目,它包含所有服务,更像是存储库您是在使用它们还是将它们托管在新的空项目中?如果您托管它们,是否需要启动项目?
-
您可以在网络浏览器中浏览到
http://services.local.com/Api.svc/wsHttp吗?如果有,你看到了什么? -
我已经将该项目引用到我的网络(dll)中,我的启动项目是网络
-
您是否使用“存储库”来使用托管在其他地方的 WCF?
-
是的,服务工作正常。我创建了一个测试项目,并且能够从测试中连接。
标签: c# .net asp.net-mvc wcf wcf-configuration