الاثنين، 16 ديسمبر 2013

CRM2011:Could not find default endpoint element that references contract 'OracleService' in the ServiceModel client configuration section.

This error occur when you try run custom step workflow which call WCF service in dll file.
To solve to problem do the following:

1-Open cmd
2-run::  cd C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\x64
3-run: svcutil.exe WCFServiceURL /out:"C:\ServiceOutFolder\ServiceName.cs" /config:""C:\ServiceOutFolder\ServiceName.config"
4- Copy the "ServiceName.cs" and "ServiceName.config" file to your Project code.
5- Write the following code to get Service Client:
           BasicHttpBinding myBinding = new BasicHttpBinding();
            myBinding.Name = "BindingName";    // from AppConfig File
            myBinding.Security.Mode = BasicHttpSecurityMode.None;
            myBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.None;
            myBinding.Security.Transport.ProxyCredentialType = HttpProxyCredentialType.None;
            myBinding.Security.Message.ClientCredentialType = BasicHttpMessageCredentialType.UserName;
            EndpointAddress endPointAddress = new  EndpointAddress("WCFServiceURL");

            ServiceNameClient client = new ServiceNameClient(myBinding, endPointAddress);  // for ex:OracleServiceClient

// Now use this client to call methods in Service
            MyServiceName sv = client;


Your Service URL ex: http://localhost/OracleWS/OracleService.svc?wsdl

ليست هناك تعليقات:

إرسال تعليق