我的是windows应用程序。我正在使用网络服务。当我向我的应用程序添加服务引用时,它会生成一个 app.config 文件。
<client>
<endpoint address="http://58.71.131.223/uucpapi/UUCPAPIServer.svc"
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IUUCPAPIServer"
contract="UUCPAPI.IUUCPAPIServer" name="WSHttpBinding_IUUCPAPIServer">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
</client>
我把这个 API 称为
UUCPAPI.UUCPAPIServerClient uucp = new UUCPAPI.UUCPAPIServerClient();
在这里它抛出异常
ServiceModel
在客户端配置部分中找不到引用合同“UUCPAPI.IUUCPAPIServer”的默认端点元素。这可能是因为没有为您的应用程序找到配置文件,或者因为在客户端元素中找不到与此合同匹配的端点元素。”