tags:

views:

53

answers:

3

I am trying to initialize an application that runs in IIS 7 and I cannot start it because I receive the following error:

Object reference not set to an instance of an object error
eInitWizard.frmMain.CreateVirtualDirectories()
eInitWizard.frmMain.DoObjective()
eInitWizard.frmMain.wpResume_CloseFromNext(Object sender, PageEventArgs e)

What can be the cause of that error?

+2  A: 

The error means that you tried to use some object that wasn't there (it was the null reference). The rest is where that error was detected: in your CreateVirtualDirectories() method, that was called from DoObjective().

The message doesn't specify further exactly where (what line) the error occurred.

You could get that exception with code like the following:

Object myObj = MethodThatReturnsAnUnexpectedNull();
Console.WriteLine(myObj.ToString());

as I'm calling a method on myObj while that could be null.

Hans Kesting
+2  A: 

You are getting this error, because you are trying to use an object that is nothing/null.

Start with the CreateVirutalDirectories. Put in a breakpoint at the top of that method and step through line by line till you find where the nothing.null reference is.

It should not take long to find out what the problem is.

Tony Abrams
A: 

post the full error message, there must be a number line somewhere. if it's a degug session, see details -> inner exception.

hope this helps, Ilya.

portland