MS311 CRM2015 Online and Azure - Xrm Connection string not working

May 12, 2015 at 3:51 PM
Please I need urgent help. Thanks in advance
Hello, I'm trying to connect MS311 Web portal (Azure) with CRM Online. I have tried the connection string from the installation manual, but cannot connect to CRM. I have tried the solution On prem (Hyper-V) and worked fine on a single server.
This is my actual connection string: Url=https://portalciudadano.crm4.dynamics.com; Username=kiko@portalciudadano.onmicrosoft.com; Password=xxxxxxxx;
Portal is https://atechneaportalciudadano.azurewebsites.net/ and I get the following error:
Server Error in '/' Application.

Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[NullReferenceException: Object reference not set to an instance of an object.]
XRM_Forms.ViewModel.XRMViewModel.GetOptionSetValueLabel(String entityName, String fieldName, Int32 optionSetValue, Int32 lcid) +430
XRM_Forms.ViewModel.XRMFormOfflineConfiguration.LoadConfiguration(String XRMFormName) +869
XRM_Forms.Common.CRMGlobal.LoadXRMClient() +40
Microsoft_311.Global.Application_Start(Object sender, EventArgs e) +230

[HttpException (0x80004005): Object reference not set to an instance of an object.]
System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +9916673
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +118
System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +172
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +336
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +296

[HttpException (0x80004005): Object reference not set to an instance of an object.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9930568
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +254


If I use Url=http://portalciudadano.crm4.dynamics.com; Username=kiko@portalciudadano.onmicrosoft.com; Password=xxxxxxxx;
I can view the portal home page, but once I go to te map I get the following error:
Server Error in '/' Application.

Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[NullReferenceException: Object reference not set to an instance of an object.]
Microsoft.Xrm.Sdk.Client.ProxyTypesBehavior.System.ServiceModel.Description.IEndpointBehavior.ApplyClientBehavior(ServiceEndpoint serviceEndpoint, ClientRuntime behavior) +26
Microsoft.Xrm.Client.Services.OrganizationService.CreateServiceConfiguration(CrmConnection connection) +233
Microsoft.Xrm.Client.Services.OrganizationService.GetServiceConfiguration(CrmConnection connection) +135
Microsoft.Xrm.Client.Services.OrganizationService.ToOrganizationServiceProxy(CrmConnection connection) +72
Microsoft.Xrm.Client.Services.OrganizationService.ToOrganizationService(CrmConnection connection) +10
Microsoft.Xrm.Client.Services.<>c__DisplayClass2.<.ctor>b__0() +18
System.Lazy1.CreateValue() +415
System.Lazy
1.LazyInitValue() +152
System.Lazy1.get_Value() +75
Microsoft.Xrm.Client.Services.InnerOrganizationService.UsingService(Func
2 action) +111
Microsoft.Xrm.Client.Services.OrganizationService.Execute(OrganizationRequest request) +75
Microsoft.Xrm.Client.Services.CachedOrganizationService.InnerExecute(OrganizationRequest request) +151
Microsoft.Xrm.Client.Services.OrganizationServiceCache.InnerExecute(TRequest query, Func2 execute, Func2 selector) +12
Microsoft.Xrm.Client.Services.<>c__DisplayClass43.<LookupAndInsert>b__2(ObjectCache cache) +153
Microsoft.Xrm.Client.Caching.<>c__DisplayClass6
1.<Get>b__5(String key) +20
Microsoft.Xrm.Client.Threading.<>c__DisplayClass51.<Get>b__3() +39
Microsoft.Xrm.Client.Threading.<>c__DisplayClass1.<Lock>b__0(Mutex _) +10
Microsoft.Xrm.Client.Threading.MutexExtensions.Lock(String key, Int32 millisecondsTimeout, Action
1 action) +95
Microsoft.Xrm.Client.Threading.MutexLockProvider.Lock(String key, Int32 millisecondsTimeout, Action action) +69
Microsoft.Xrm.Client.Threading.LockProvider.Get(String key, Int32 millisecondsTimeout, Func2 loadFromCache, Func2 loadFromService) +162
Microsoft.Xrm.Client.Threading.LockProvider.Get(String key, Func2 loadFromCache, Func2 loadFromService) +77
Microsoft.Xrm.Client.Threading.LockManager.Get(String key, Func2 loadFromCache, Func2 loadFromService) +85
Microsoft.Xrm.Client.Caching.ObjectCacheProvider.Get(ObjectCache cache, String cacheKey, Func2 load, Action2 insert, String regionName) +199
Microsoft.Xrm.Client.Caching.ObjectCacheManager.Get(ObjectCache cache, String cacheKey, Func2 load, Action2 insert, String regionName) +91
Microsoft.Xrm.Client.Services.OrganizationServiceCache.LookupAndInsert(TRequest query, Func2 execute, Func2 selector, String selectorCacheKey) +281
Microsoft.Xrm.Client.Services.OrganizationServiceCache.Get(TRequest query, Func2 execute, Func2 selector, String selectorCacheKey) +71
Microsoft.Xrm.Client.Services.OrganizationServiceCache.InnerExecute(TRequest request, Func2 execute, Func2 selector, String selectorCacheKey) +144
Microsoft.Xrm.Client.Services.OrganizationServiceCache.Execute(OrganizationRequest request, Func2 execute, Func2 selector, String selectorCacheKey) +62
Microsoft.Xrm.Client.Services.CachedOrganizationService.Execute(OrganizationRequest request, Func5 execute, Func2 selector, String selectorCacheKey) +104
Microsoft.Xrm.Client.Services.CachedOrganizationService.Execute(OrganizationRequest request, Func2 selector, String selectorCacheKey) +189
Microsoft.Xrm.Client.Services.CachedOrganizationService.Execute(OrganizationRequest request) +129
Microsoft.Xrm.Client.Services.CachedOrganizationService.Execute(OrganizationRequest request) +9
Microsoft.Xrm.Sdk.Client.OrganizationServiceContext.Execute(OrganizationRequest request) +84
Microsoft.Xrm.Sdk.Linq.QueryProvider.RetrieveEntityCollection(OrganizationRequest request, NavigationSource source) +283
Microsoft.Xrm.Sdk.Linq.QueryProvider.Execute(QueryExpression qe, Boolean throwIfSequenceIsEmpty, Boolean throwIfSequenceNotSingle, Projection projection, NavigationSource source, List
1 linkLookups, String& pagingCookie, Boolean& moreRecords) +322
Microsoft.Xrm.Sdk.Linq.QueryProvider.Execute(QueryExpression qe, Boolean throwIfSequenceIsEmpty, Boolean throwIfSequenceNotSingle, Projection projection, NavigationSource source, List1 linkLookups) +67
Microsoft.Xrm.Sdk.Linq.QueryProvider.Execute(Expression expression) +153
Microsoft.Xrm.Sdk.Linq.QueryProvider.GetEnumerator(Expression expression) +59
Microsoft.Xrm.Sdk.Linq.Query
1.GetEnumerator() +72
System.Collections.Generic.List1..ctor(IEnumerable1 collection) +369
System.Linq.Enumerable.ToList(IEnumerable`1 source) +58
Microsoft_311.Map.getGeneralRequests(String days, String priority, String status) +2893
Microsoft_311.Map.GetAllLocations() +62
Microsoft_311.Map.Page_Load(Object sender, EventArgs e) +88
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +51
System.Web.UI.Control.OnLoad(EventArgs e) +92
System.Web.UI.Control.LoadRecursive() +54
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +772
Coordinator
May 12, 2015 at 3:59 PM

For Azure you need to actually add the connection via the Azure Management Console after publishing the web portal to Azure.

Did you do this?

If you are still having issues, please let us know and I am happy to schedule a call to help resolve the issues. Please send me email directly to [email removed]

Thanks

Ken

b. When Publishing is complete you will get the following message from a new Browser window that will open. This is expected.

c. Now we need to go back the Azure Management site and fix the connection strings for the web portal. Log back into the Azure Management Portal using your Microsoft Account. Select Web Sites and then Select the newly created Web Site in this case it will be MS311Test.

d. Then Select Configure

e. Scroll down the Connection String Section

f. Now we need to create to Connection strings. One for XRM and one for DefaultConnection. Let’s creaste the XRM connection string first. Enter XRM into the Name Field, then enter the following connection string into the value field replacing the CRMDomainName with your Domain name, UserName and DomainName with your Admin Username, and then Admin Password, then select Custom from the drop down. Then Click Save at the bottom of screen to save the changes.

Url=https://CRMDomainName.dynamics.com; Username=[email removed]; Password=UserPassword;

g. Now create the DefaultConnection string to the SQL DB for Membership. First you need to get the actual connection string for the DB from the Azure Management Portal. Click on SQL DB, then the Name of the SQL DB, then click on View SQL Database Connection Strings.

h. Copy the connection string from the ADO.NET section

i. Now let’s go back and update the Connection string for the Web Site. Click on Web Sites, then the new Web Site, then scroll down to the Connection String section.

j. Enter DefaultConnection into the Name Field, Paste the Connection String copied to the Value Field (NOTE: you need to update the Password in the connection string before saving it), then click Save at the bottom of the page. You screen should look like this:

k. Now go back to the browser window for the Website and refresh the page and the website should now come up.

May 12, 2015 at 4:25 PM
Thanks Kem for your answer. I did Publish the web site, then did work on the connection strings from Azure portal, I did follow the install document step by step. I'll send you an email.
May 12, 2015 at 4:28 PM
Sorry Ken, I don't have your email, would ypu please send me an email to revm@hotmail.com
Thx.
May 15, 2015 at 8:41 PM
Hi Ken. I have solved the connection problem. It was an issue importing ID Generator solution into my CRM. CRM Online is in Spanish base language and I had not installed English language, as consequence labels where not imported.
I’m facing now a new problem, an XRMForms.dll error on portal side when base language is other than English. Indeed, the problem is if the base language for the account used in Xrm connection string, is other than English.
This is the error:
Server Error in '/' Application.

Sequence contains no elements
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: Sequence contains no elements

Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[InvalidOperationException: Sequence contains no elements]
System.Linq.Enumerable.First(IEnumerable`1 source) +269
XRM_Forms.Controls.XRMForm.getTabLabel(XElement tab) +247
XRM_Forms.Controls.XRMForm.CreateChildControls() +4994
System.Web.UI.Control.EnsureChildControls() +83
System.Web.UI.Control.PreRenderRecursiveInternal() +42
System.Web.UI.Control.PreRenderRecursiveInternal() +155
System.Web.UI.Control.PreRenderRecursiveInternal() +155
System.Web.UI.Control.PreRenderRecursiveInternal() +155
System.Web.UI.Control.PreRenderRecursiveInternal() +155
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +974

Any help is welcome.

Thanks in advance
Coordinator
May 22, 2015 at 7:55 PM

Hello,

Can you tell me what option you used for setting up the CRM instance?

Which one of these did you use?

There are two options for install the Dynamics CRM solution for CRM2015.

a. Full Deployment package (single .exe file)

b. Manual Solution Import and Sample Data.

If you used the Manual option please verify you manually imported all the data files especially the 8-Web Content data file as that is what controls the Service Requests being active on the Web Portal.

Can you also verify that the MAP and Knowledge base pages on the Web Portal are working?

Let me know how you did the install and we can go from there.

Ken