[英]Could not find default endpoint element that references contract in WCF
I've mvc web project and I have added another empty project which holds all the services more like repository. 我已经有了mvc Web项目,并添加了另一个空项目,该项目包含所有类似于存储库的服务。
So I'm having issue where it throws error and I can't figure it out why even though I have added bindings in Web.config. 所以我有一个问题,它引发错误,即使我在Web.config中添加了绑定,我也无法弄清楚为什么。
Error: 错误:
Could not find default endpoint element that references contract 'DataService.ISDService' in the ServiceModel client configuration section.
在ServiceModel客户端配置部分中找不到引用合同'DataService.ISDService'的默认终结点元素。 This might be because no configuration file was found for your application, or because no endpoint element matching this contract could be found in the client element.
这可能是因为找不到您的应用程序的配置文件,或者是因为在客户端元素中找不到与该协定匹配的端点元素。
App.config: 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: 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>
I can't figure out where I'm going wrong. 我不知道我要去哪里。
为了使其正常工作,您必须将所有内容都移到Web.config上,因为托管该服务的是Web应用程序。
The solve your problem, the calling project needs to have the the same configuration for the services. 为了解决您的问题,调用项目的服务必须具有相同的配置。 Just copy the
<System.ServiecModel />
part into your website Webconfig. 只需将
<System.ServiecModel />
部分复制到您的网站Webconfig中。 Also, you may need to copy the same settings in the repository. 另外,您可能需要在存储库中复制相同的设置。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.