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

Connection to an https external service with an untrusted certificate

$
0
0

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.

 


Viewing all articles
Browse latest Browse all 79901

Trending Articles



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