web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Connect to Dynamics CRM 2015 On-Premise Using CRMServiceClient from external application

(0) ShareShare
ReportReport
Posted on by

Hello all,

I hopefully have a pretty quick and easy question regarding the connection of external apps to Dynamics CRM 2015 on-premise.

Long story short, I have the following Scenario...

1. Ribbon button on an form is pressed

2. An ajax call is performed via JavaScript to a WCF service.

3. The WCF service performs its requested operations then connects to the CRM using CrmServiceClient.

4. The ajax gets the response that the WCF service is done running and it gives the response back to the user.

This feature is used over 50 times in a day, every single day.

Maybe once every 4 or 5 days the WCF service will throw an exception on one of the statements that performs an update or create operation against the CRM.

The error is generally something along the lines of 'An error occured while processing this request.'

When the error occurs, the user will press the exact same button on the same form again, and it will go through and create the additional record through the WCF service without any issues....

Since the same exact record will work the second time around, and it only happens once every couple hundred requests... my only thought is that it might be related to how I am connecting to the CRM?

This is how I am initializing my connection to the CRM:

CrmServiceClient service = new CrmServiceClient(WebConfigurationManager.ConnectionStrings["connectionString"].ConnectionString;

if(service.IsReady)

{

// Perform my business logic.

}

Basically, my question is, is the above code the best way to connect to an on-premise version of CRM or is there something else I should be doing?

Looking at this post on MSDN - https://msdn.microsoft.com/en-us/library/jj602970.aspx - I see this:


CrmServiceClient service = new CrmServiceClient(WebConfigurationManager.ConnectionStrings["connectionString"].ConnectionString;
IOrganizationService orgService = (IOrganizationService)service.OrganizationWebProxyClient != null ? (IOrganizationService)service.OrganizationWebProxyClient : (IOrganizationService)service.OrganizationServiceProxy;

Is the IOrganizationService statement needed? If so, why and when should I use it? Do you think this would even make a difference in the issue I am experiencing?

Thank you so much!

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Community Member Profile Picture
    on at

    I posted in this hopes that the issue was caused by a simple connection issue on my part to the CRM.

    If this isn't the case, I certainly understand that it might be difficult to trouble shoot without access to the javascript or web service code.

    To answer my overall higher arching question of how to connect to the CRM,

    I found the following link helpful.

    community.dynamics.com/.../252864

    I'll just have to continue looking into the issue one step at a time from here.

    Thanks everyone for looking.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans