简体   繁体   中英

Could not find endpoint element with name 'xxxxx' and contract 'yyy' in the ServiceModel client configuration section

I generated a proxy via this command -

and then copied the elements from the resulting app.config into the app.config file of an existing project.

When I try to access the client in that config file via-

it should reference the second client below:

  <client>
  <endpoint address="https://webservices.hmsa.com/EDI27X/cstc/Hipaa27XService.svc"
            binding="customBinding" 
            bindingConfiguration="wsHttpEndpoint" 
            contract="HIPAA27XServiceContract" 
            name="wsHttpEndpoint" />
  <endpoint address="https://12.23.28.113:9047/MHService" 
            binding="customBinding"
            bindingConfiguration="MHService_MHSPort" 
            contract="MHS"
            name="MHSPort" />
</client>

but instead I get the error;

If I go to definition of MHSClient, it takes me to the proxy.cs file and this line;


solved with the following-


Once I created the endpoint address then I could instantiate/create the service using the correct overload;
var b = new CustomBinding() as the first argument and for the second argument,
the correct endpoint address.

complicated - WS-Security - IBM Websphere server interop <-> wcf client
within the context of various .NET and Visual Studio implementations of web services...
oh my

You probably need to set the ConfigurationName property of the ServiceContractAttribute above the service contract interface, ConfigurationName should match your contract name.

'VB.NET:
Imports System.ServiceModel

<ServiceContract([Namespace]:="http://yournamespace", ConfigurationName:="MHS")> _
Public Interface MHS

//C#:
using System.ServiceModel;

[ServiceContract(Namespace="http://yournamespace", ConfigurationName="MHS")]
public interface MHS

Look at the auto generated code here: MSDN: How to: Create a Windows Communication Foundation Client

Also worth looking at: MSDN: ServiceContractAttribute Class

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM