object reference not set to an instance of an object error coming when deployin to cloud

6.6k views Asked by At

Locally the project works perfectly. It is executing and there are proper entries in database. But when I am deploying it to cloud at staging it is giving me this error as object reference not set to an instance. My project requires 2 instances of each web and worker role but since I have a limited edition to free instances I am using only 2. one each. Can that be a problem ? I am using SDK 1.8 It is ASP.Net project.

Can anyone suggest me how to resolve this issue ?

4

There are 4 answers

0
DrNix On

I haved same error today, after upgrading Azure SDK to version 2.5 I'm add configuration diagnostics to each role in service and the error disappeared

0
Gazi On

I ran into the same issue when upgrading to 2.5. It created the .wadcfgx files and they looked sensible but deployment via Visual Studio would still fail with the same error.

  • Applying Diagnostics extension.
  • Object reference not set to an instance of an object.

Package deployment would still work. I was able to get past it via the following steps.

  1. Delete the generated .wadcfgx files
  2. Have Visual Studio regenerate them via the context menu option on the role.
  3. Doing a clean build and redeploying.

I'd love to know what the actual error was and how to get more details. The messaging is pretty terrible.

2
Ryan On

I had a similar issue where I was getting the following when publishing from Visual Studio 2013 to my Azure Cloud Service with a web role and a worker role. This occurred after upgrading the project from Azure SDK v2.4 to v2.5:

2:41:59 PM - Applying Diagnostics extension.

2:42:01 PM - Object reference not set to an instance of an object.

Even after working with a Microsoft Developer I could not get it to show me any kind of stack trace to indicate where the null was coming from. He just happened to notice something funny in my cloud configuration under the "Roles" folder that looked strange.

The problem was that the diagnostics.wadcfgx is needed for an SDK 2.5 project, whereas before that version the diagnostics.wadcfg is needed. (Note the "x" in the file extension.) Apparently the worker role did not have this file automatically created when the project was upgraded.

In order to fix this particular issue, just right click on the role (in the roles folder under cloud configuration) and select "Add Diagnostic Configuration", then Build the solution and attempt to publish. These diagnostics files are ONLY needed when publishing directly from Visual Studio.

0
Artyom On

Had this with MS Azure Tool 2.9. Turned out that it needed the following in diagnostics.wadcfgx :

  <PrivateConfig xmlns="http://schemas.microsoft.com/ServiceHosting/2010/10/DiagnosticsConfiguration">
    <StorageAccount endpoint="" />
  </PrivateConfig>

Hope it helps someone!