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)

Works locally however moved to Azure website - Guid user - Object reference not set to an instance of an object

(0) ShareShare
ReportReport
Posted on by 140

Hi all,

I'm fairly new to Azure and CRM and after completing a working connection to CRM on my local site, I've stumbled across this error when I moved to it to my Azure site. Please can you help me find where the issue lies? I'm thinking it could be a configuration problem or an actual problem with the CRM connection when not working locally:

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.

[NullReferenceException: Object reference not set to an instance of an object.]
   umbraco.test.Page_Load(Object sender, EventArgs e) in ...my file path...
   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.Control.LoadRecursive() +145
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +772

The error highlights line 43:

Line 43: Guid userid = ((WhoAmIResponse)_service.Execute(new WhoAmIRequest())).UserId;
Line 44:             if (userid != Guid.Empty)
Line 45:             {

...I've also picked out this:

OrganizationServiceProxy serviceProxy = new OrganizationServiceProxy(serviceUri, null, credentials, null);
serviceProxy.EnableProxyTypes();
_service = (IOrganizationService)serviceProxy;

I would really appreciate advise on this. I haven't included the full code as I'm not 100% sure it is down to the code since it works locally.



Source Error:

*This post is locked for comments

I have the same question (0)
  • Verified answer
    StephNicolaou Profile Picture
    140 on at

    I had a missing assembly reference.  I needed Microsoft.IdentityModel even though I didn't use it in the local version.

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