Hi all,
I have hosted a WCF service on one of the ports of my IIS server. when I consume the service it fails to connect to the CRM Application. However when I browse the CRM application from the browser on the server the service is able to connect to the CRM. Do I need to install a Security Certificate on the server to make a trusted connection ???
Suggestions Please!!
Thanks in advance
Prem
*This post is locked for comments
have you figured the solution?
sorry here , i edited one of the names in the stacktrace before putting it here but missed editing the second one.. actually both the URL's are same :P.
Anyways , yes i am able to connect using the code you mentioned above but the problem is as i have mentioned in my first query that i am only able to connect when i create a connection manually by browsing the CRM Application on my browser; once that connection is gone service again fails to connect with the above specified stacktrace.
Hi Prem,
I can see two url in error msg..
1) ymsltest.api.crm5.dynamics.com
2) test.api.crm5.dynamics.com
which of these is correct?
Usually you get this exception when protocol is wrong or url is wrong - Were you able to connect through a simple console app ... something like
string connectionString = @"AuthType=Office365;Username=me@myorg.onmicrosoft.com;Password=mypassword;Url==https://org.crm5.dynamics.com" using (var con = new Microsoft.Xrm.Tooling.Connector.CrmServiceClient(connectionString)) { Guid orgId = ((WhoAmIResponse)con.Execute(new WhoAmIRequest())).OrganizationId; }
Thanks for your reply Prateek,
My syntax matches with the 2nd syntax that you mentioned(Organization Service).
Error details are as follows:
System.ServiceModel.FaultException`1[System.ServiceModel.ExceptionDetail]: Could not establish trust relationship for the SSL/TLS secure channel with authority 'test.api.crm5.dynamics.com'. (Fault Detail is equal to An ExceptionDetail, likely created by IncludeExceptionDetailInFaults=true, whose value is:
System.ServiceModel.Security.SecurityNegotiationException: Could not establish trust relationship for the SSL/TLS secure channel with authority 'ymsltest.api.crm5.dynamics.com'. ----> System.Net.WebException: The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel. ----> System.Security.Authentication.AuthenticationException: The remote certificate is invalid according to the validation procedure.
at System.Net.Security.SslState.StartSendAuthResetSignal(ProtocolToken message, AsyncProtocolRequest asyncRequest, Exception exception)
at System.Net.Security.SslState.ProcessReceivedBlob(Byte[] buffer, Int32 count, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ProcessReceivedBlob(Byte[] buffer, Int32 count, AsyncProtocolRequest asyncReques...).
CrmServiceClient can be used for Organization service as well as webAPI.
Does you syntax look like this:
CrmServiceClient crmSvc = new CrmServiceClient("<UserName>", CrmServiceClient.MakeSecureString("<Password>"), "<CrmRegion>", "<OrgName>", useUniqueInstance:false, <orgDetail>,
<userIdentifier>, <clientId>, <redirectUri>, <tokenCachePath>, <externalOrgWebProxyClient>, PromptBehavior.Auto);
Or follow this:
CrmServiceClient crmSvc = new CrmServiceClient("<UserName>", CrmServiceClient.MakeSecureString("<Password>"), "<CrmRegion>", "<OrgName>", useUniqueInstance:false, useSsl:false, <orgDetail>, isOffice365:true);
In case its the first syntax then you need to register you app on Azure as guided in the link.
If it is the second format then please share the extact error message that you are receiving.
Thanks,
PS
Hi,
I am using CrmServiceClient to connect to CRM.
How are you trying to connect to CRM? Using Organization service or using webAPI?
If you are using webAPI then you need to register your application on Azure first so that authentication can happen.
This might be helpful: msdn.microsoft.com/.../mt595797.aspx
Do share the error message if this doesnt work.
Thanks,
PS
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,253 Super User 2024 Season 2
Martin Dráb 230,188 Most Valuable Professional
nmaenpaa 101,156