1

我有一个调用 Web 服务 AddressValidationService 的 wpf C# 应用程序。我知道它曾经可以工作(在我开始从事该项目之前),但现在不行了。异常发生在这里:

var addrSvc = new AddressValidationServiceReference.AddressValidationServiceClient();

例外是:

在 ServiceModel 客户端配置部分中找不到引用合同“AddressValidationServiceReference.IAddressValidationService”的默认端点元素。这可能是因为没有为您的应用程序找到配置文件,或者因为在客户端元素中找不到与此合同匹配的端点元素。

这是来自我的 app.config:

    <client>
        <endpoint address="http://rdbval/EASTServices/AddressValidationService.svc"
            binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IPolicyRetriever"
            contract="AddressValidationServiceReference.IPolicyRetriever"
            name="BasicHttpBinding_IPolicyRetriever" />
        <endpoint address="http://rdbval/EASTServices/AddressValidationService.svc"
            binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IAddressValidationService"
            contract="AddressValidationServiceReference.IAddressValidationService"
            name="BasicHttpBinding_IAddressValidationService" />
    </client>

也许有人可以告诉什么是错的?谢谢。

4

2 回答 2

1

endpoints您需要.configServiceModel client项目中插入或更新IAddressValidationService

于 2012-07-31T16:33:47.227 回答
1

Probably stupid guess, but anyway: are you sure your config file is the one from your client application? =). try reading some AppSetting from it for example to ensure you are using the correct one if you are not sure. The config itself looks fine.

于 2012-07-31T16:03:27.860 回答