Hello,
I am developping a plug-in on CRM online 2015 and i have to use a web service developped by my team that use the https protocol with a certificate that we generated with IIS.
Here is the code i started with to consume the web service on my laptop:
string urlServiceInterfaceSI = "*************** the web service url *****************";
ChannelFactory<ISIKorian> myChannelFactory = new ChannelFactory<ISIKorian>();
EndpointAddress myEndpoint = new EndpointAddress(urlServiceInterfaceSI);
BasicHttpsBinding myBindingHttps = new BasicHttpsBinding();
myChannelFactory = new ChannelFactory<IService>(myBindingHttps, myEndpoint);
IService client = myChannelFactory.CreateChannel();
SendDataResult result = client.SendData(param);
This gave me SecurityNegociationException saying that a SSL\TLS trust connexion couldn't be etablished.
So after a digging a little i found a piece of code allowing to solve the problem.
Somthing like : ServicePointManager.CertificatePolicy = new TrustAllCertificatePolicy();
It worked on my laptop. But when i run the same code on the plugin i have following execption :
Request for the permission of type 'System.Security.Permissions.SecurityPermission.
Obviously i don't have the right to modify the CertificatePolicy.
Is it because crm online doesn't allow it in general?
How can i get around that to consume the external web service?
Thanks in advance.