Question

I have an online CRM and my local on-premice CRM installtion. When I deploy my solution in the online CRM I build my Server URL for accessing the REST services of the CRM like this:

return string.Format("{0}/XRMServices/2011/OrganizationData.svc", LocalServerHost);

When I deploy that on the on-premise CRM this will not work. Instead I have to add the organization name to the URL, like this:

return string.Format("{0}/<MyOrganization>/XRMServices/2011/OrganizationData.svc", LocalServerHost);

I want to be able to deploy my application to both, on-premise and online CRMs without changing the code everytime. How can I configure my on-premise CRM to use a default organization?

Cheers, Arne

Was it helpful?

Solution

The main issue is that CRM Online uses the IFD configuration, which produces a URL like this:

https://<orgname>.crm.dynamics.com

But On-Premise (without IFD) uses a URL that looks like this:

http://<servername>/<orgname>/...

The easiest way to fix your problem is probably to configure IFD on your On-Premise install so you will get a URL that looks like CRM Online. Then your environments will match and your first line of code should work on both.

Configuring IFD is not for the faint of heart, so another option (although somewhat ugly) would be to add a condition to your javascript that looks for "crm.dynamics.com" in the LocalServerHost variable. If it is there, use the Online URL format, otherwise use the On-Premise URL format.

OTHER TIPS

The best way to do this is through the web.config file in your solution.

Here is an example: http://www.c-sharpcorner.com/UploadFile/amit12345/web-config-transformation/

This will allow you to have different builds that utilize the transformations. When you build a version that you want to deploy to your on-prem instance you simply choose that build target. The only thing is that will require you to access the connection string from your config file. Let me know if you need help with that.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top