I am writing code which is targeting the .NET Framework 4. to make a WCF proxy called "CIMClient".
In VS2019 C#, I used Add Service Reference, and imported a wsdl file along with its xsd files.
The wsdl defines an interface named "Operations".
Within the same DLL assembly, here is a section of my C# code:
After defining the request variable,
using (OperationsClient client = new OperationsClient("SOAP"))
{
ResponseMessageType response = client.Request(request);
return response;
}
This code above cannot find the following Web.config entry:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="IORRServiceSoapBinding">
<security mode="Transport">
<message clientCredentialType="Certificate"
algorithmSuite="Basic192Sha256Rsa15" />
</security>
</binding>
<binding name="SOAP" >
<security mode="Transport" />
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address=" ... "
binding="basicHttpBinding"
bindingConfiguration="IORRServiceSoapBinding"
contract="IIORR"
name="IORRPort" />
<endpoint address=" ... "
binding="basicHttpBinding"
bindingConfiguration="SOAP"
contract="CIMClient.Operations"
name="SOAP">
</endpoint>
</client>
</system.serviceModel>
I get the following error:
Could not find endpoint element with name 'SOAP' and contract 'CIMClient.Operations' 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 name could be found in the client element.
Can you help me identify whether or not this code can even see my Web.config file?
When I change the code to
using (OperationsClient client = new OperationsClient())
Then I get an error stating
Could not find default endpoint element that references contract 'CIMClient.Operations' 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.