简体   繁体   English

找不到引用合同的默认终结点元素…但是应用程序仍然有效

[英]Could not find default endpoint element that references contract… But application still works

I am currently working on a WPF Application, using a different project to call a WebService. 我目前正在使用其他项目来调用WebService的WPF应用程序。 When I try to build i get this error: 当我尝试构建时,出现此错误:

Could not find default endpoint element that references contract 找不到引用合同的默认端点元素
'VisitorRegistrationWebService.VisitorRegistrationWebServiceSoap' in the ServiceModel client configuration section. ServiceModel客户端配置部分中的“ VisitorRegistrationWebService.VisitorRegistrationWebServiceSoap”。 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. 这可能是因为找不到您的应用程序的配置文件,或者是因为在客户端元素中找不到与该协定匹配的端点元素。

The app.config from my webservice project is just the same as the one from my WPF project. 我的Webservice项目中的app.config与WPF项目中的app.config相同。

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<bindings>
  <basicHttpBinding>
    <binding name="VisitorRegistrationWebServiceSoap" />
  </basicHttpBinding>
</bindings>
<client>
  <endpoint address="http://localhost/webservices/VisitorRegistrationWebService.asmx"
      binding="basicHttpBinding"   bindingConfiguration="VisitorRegistrationWebServiceSoap"
      contract="BasicVisitorRegistrationWebService.VisitorRegistrationWebServiceSoap"
      name="VisitorRegistrationWebServiceSoap" />
</client>
</system.serviceModel>
</configuration>

The strange thing is that I can run the project and use the webservice to get data, but the error will not go away, no matter how many times I clean and rebuild my solution. 奇怪的是,我可以运行该项目并使用Web服务来获取数据,但是无论我清理并重建解决方案多少次,错误都不会消失。

in error message, contract name is 'VisitorRegistrationWebService.VisitorRegistrationWebServiceSoap' 在错误消息中,合同名称为“ VisitorRegistrationWebService.VisitorRegistrationWebServiceSoap”

and in endPoint configuration, contract="BasicVisitorRegistrationWebService.VisitorRegistrationWebServiceSoap" 并且在endPoint配置中,contract =“ BasicVisitorRegistrationWebService.VisitorRegistrationWebServiceSoap”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM