Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 46379

Error While Calling WCF Service in Plugin in MSCRM 2016 online???

$
0
0

Dear All,

         i have built a simple Hello World WCF Service as below,hosted the same in a console application and able consume the web service in a ASP .Net Website,but when i am calling the same web service in mscrm2016 online instance plugin i  am getting  Error(the plugin is register in sandbox mode as it is only one option in mscrm online).

Error

The communication object,System.ServiceModel.ChannelFactory`1[CommonPluginSolution.ExternalServiceReference.IHelloService], cannot be modified while it is in the Opening state.

 

1.Webservice Code

public class HelloService : IHelloService
{

public string GetMessage(string name)
{
return "Hello " + name;
}
}
}

2.Plugin code for consuming wcf service

BasicHttpBinding myBinding = new BasicHttpBinding();
myBinding.Name = "BasicHttpBinding_IHelloService";
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("localhost/HelloService");
ExternalServiceReference.HelloServiceClient myClient = new ExternalServiceReference.HelloServiceClient(myBinding,endPointAddress);
string result = myClient.GetMessage("Ramakanta");

3.End point details

<endpoint address="localhost/HelloService" binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_IHelloService" contract="ExternalServiceReference.IHelloService"
name="BasicHttpBinding_IHelloService" />

 


Viewing all articles
Browse latest Browse all 46379

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>