2

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 ?

anzie001
  • 231
  • 3
  • 12
  • how are you deploying it? – washcloth Nov 12 '14 at 21:05
  • Need more info. What are you doing when you see this error? Where do you see it? What do your Diagnostics.Trace statements show? Which line of code is throwing that error? etc... – kwill Nov 12 '14 at 21:50
  • I am creating a package to publish it to staging environment.The error is the one i mentioned. It is giving a filename and says it has NULL Value Exception thrown. While it runs successfully on local machine. – anzie001 Nov 12 '14 at 22:35
  • This error usually happens when you forget to set "copy local" to "true" in non GAC assemblies (e.g.: MVC files referenced directly and not through NuGet) – gbellmann Nov 13 '14 at 19:32
  • gbellmann I tried doing that. To set copy local to True it is not working. Kwill I tried Setting up diagnostics for Windows Azure Web Role , Checked if the application pools are started or not. But nothing Works. – anzie001 Nov 15 '14 at 01:47
  • This answer had the solution for me: http://stackoverflow.com/questions/28445294/trying-to-publish-using-azure-sdk-2-5-results-in-a-null-ref-object-reference-no – ChrisW Apr 30 '15 at 16:49

4 Answers4

9

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.

Community
  • 1
  • 1
Ryan
  • 121
  • 1
  • 6
2

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

DrNix
  • 21
  • 1
2

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!

Artyom
  • 3,507
  • 2
  • 34
  • 67
0

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.

Gazi
  • 21
  • 4