C# 找不到引用协定的默认终结点元素。。。但应用程序仍然有效
我目前正在开发一个WPF应用程序,使用另一个项目来调用WebService。 当我尝试构建时,会出现以下错误: 找不到引用协定的默认终结点元素C# 找不到引用协定的默认终结点元素。。。但应用程序仍然有效,c#,wpf,wcf,C#,Wpf,Wcf,我目前正在开发一个WPF应用程序,使用另一个项目来调用WebService。 当我尝试构建时,会出现以下错误: 找不到引用协定的默认终结点元素 中的“VisitorRegistrationWebService.VisitorRegistrationWebServiceSoap” ServiceModel客户端配置部分。这可能是因为 找不到应用程序的配置文件,或者因为 在客户端中可以找到与此契约匹配的端点元素 元素 我的webservice项目中的app.config与我的WPF项目中的app.c
中的“VisitorRegistrationWebService.VisitorRegistrationWebServiceSoap” ServiceModel客户端配置部分。这可能是因为 找不到应用程序的配置文件,或者因为 在客户端中可以找到与此契约匹配的端点元素 元素 我的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>
奇怪的是,我可以运行项目并使用Web服务获取数据,但无论我清理和重建解决方案多少次,错误都不会消失。在错误消息中,合同名称是“VisitorRegistrationWebService.VisitorRegistrationWebServiceSoap”
在端点配置中,contract=“BasicVisitorRegistrationWebService.VisitorRegistrationWebServiceSoap”删除引用并将其重新添加到回复中,但已经尝试过了