Could not find default endpoint element that references contract

独自空忆成欢 提交于 2019-12-14 03:59:30

问题


I created an eBay console app that runs from a service. If I run the console as is, it works fine. If I don't run it as it I get 'Could not find default endpoint element that references contract 'EbayFinding.FindingServicePortType' in the ServiceModel client configuration section.

I've tried fully qualifying my app.config but that didn't seem to fix it, does anybody have any ideas?

 <endpoint address="https://svcs.ebay.com/services/search/FindingService/v1"
            binding="basicHttpBinding" bindingConfiguration="FindingServiceSOAPBinding"
            contract="EbayFindingConsole.EbayFinding.FindingServicePortType" name="FindingServiceSOAPPort" />
    </client>

contract="FindingServicePortType" (is the original state)

Code that calls the contract:

using (FindingServicePortTypeClient client = new FindingServicePortTypeClient())

回答1:


The rest of the error message is:

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.

Since it is working when run directly, we can rule out that endpoint is missing. The only thing that remains is that configuration file is not where it is being searched for.

Check whether the directory from which you are running the console app has the configuration file for console app.

If the console app and service executable are in same directory, that directory should contain the console app configuration file.



来源:https://stackoverflow.com/questions/5237574/could-not-find-default-endpoint-element-that-references-contract

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!