Skip to main content
Hello,

I am writing a Windows application which uses the SOAP API to connect to SalesForce, for example to read and update some object. I have followed the various instructions on www.salesforce.com and based my code on the following C⌗ examples:

https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_quickstart_steps_walk_through_code.htm

I am currently using the .NET3.0 SoapClient services approach (third and last code example on the page above). When the execution reaches at line 052 loginClient = new SoapClient(); the following exception is thrown: 

System.InvalidOperationException: Could not find default endpoint element that references contract 'sforce.Soap' in the ServiceModel client configuration section. 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.

This sounds like I have a problem in my app.config file, but this configuration was autogenerated when I added the "sforce" service reference in Visual Studio 2015, based on the enterprise wsdl.jsp.xml file that is generated from SalesForce for our own database.

The serviceModel section in the generated app.config file looks like this:

<system.serviceModel>

    <bindings>

      <basicHttpBinding>

        <binding name="SoapBinding">

          <security mode="Transport" />

        </binding>

        <binding name="SoapBinding1" />

      </basicHttpBinding>

    </bindings>

    <client>

      <endpoint address="https://login.salesforce.com/services/Soap/c/39.0/0DF41000000O0XX"

        binding="basicHttpBinding" bindingConfiguration="SoapBinding"

        contract="sforce.Soap" name="Soap" />

    </client>

  </system.serviceModel>

Looking around the web and this forum in particular, it doesn't seem to me that there is an error in this app.config file, so why do I get the exception, and most importantly how do I fix this problem?

Thanks.
2 件の回答
0/9000