Thursday, March 29, 2012

Object Reference

I am having a very strange problem with my asp.net application. I am
getting error: 'Object reference not set to an instance of an object' when I
run my app from my hosting company. I have installed my application on
three different machines (including a brand new install of winxp, vs2003) at
our offices and everything seems to work fine. What could be wrong with the
server at hosting company. When i speak to them about the problem they
point the finger at my script, which I think is not a problem because it
works fine everytime I install it. I really need help with this problem.
Thanks.

ArbenHello Arapi,

Though the problem you have written may have number of reasons, but i feel
like that there is something which you make a reference on your development
machine is not present on the host machine.

Check out all the references you made, there respective dll;s are present as
well as in the hosting machine.

--
Wajahat Abbas

http://www.wajahatabbas.com
http://www.dotnetpakistan.com

"Arapi" wrote:

> I am having a very strange problem with my asp.net application. I am
> getting error: 'Object reference not set to an instance of an object' when I
> run my app from my hosting company. I have installed my application on
> three different machines (including a brand new install of winxp, vs2003) at
> our offices and everything seems to work fine. What could be wrong with the
> server at hosting company. When i speak to them about the problem they
> point the finger at my script, which I think is not a problem because it
> works fine everytime I install it. I really need help with this problem.
> Thanks.
> Arben
>
Hi Wajahat,
Thank you for your response. The way I do my deployment is: copy all the
contents of the bin folder to the bin folder on the hosting machine, and
aspx files to their respective folders.
I just dont understand that if my application works in three different
machines with default installation (no customized installations whatsoever)
why I am getting this error on the host machine?

"Wajahat Abbas" <wajahatabbas@.yahoo.com> wrote in message
news:DF2E7E87-9B3A-41D6-BA78-42226C2C5752@.microsoft.com...
> Hello Arapi,
> Though the problem you have written may have number of reasons, but i feel
> like that there is something which you make a reference on your
> development
> machine is not present on the host machine.
> Check out all the references you made, there respective dll;s are present
> as
> well as in the hosting machine.
> --
> Wajahat Abbas
> http://www.wajahatabbas.com
> http://www.dotnetpakistan.com
>
>
> "Arapi" wrote:
>> I am having a very strange problem with my asp.net application. I am
>> getting error: 'Object reference not set to an instance of an object'
>> when I
>> run my app from my hosting company. I have installed my application on
>> three different machines (including a brand new install of winxp, vs2003)
>> at
>> our offices and everything seems to work fine. What could be wrong with
>> the
>> server at hosting company. When i speak to them about the problem they
>> point the finger at my script, which I think is not a problem because it
>> works fine everytime I install it. I really need help with this problem.
>> Thanks.
>>
>> Arben
>>
>>
>
You are counting for certain objects to be present but they are not. Whether
it because they don't exist on the host machine, like the other poster
suggested, or you might lack necessary permission for using them. The bottom
line there is something in the program that is supposed to instantiate an
object and this doesn't happen.

Eliyahu

"Arapi" <aarapi@.gmail.com> wrote in message
news:%23VOk51duFHA.3424@.tk2msftngp13.phx.gbl...
> Hi Wajahat,
> Thank you for your response. The way I do my deployment is: copy all the
> contents of the bin folder to the bin folder on the hosting machine, and
> aspx files to their respective folders.
> I just dont understand that if my application works in three different
> machines with default installation (no customized installations
whatsoever)
> why I am getting this error on the host machine?
> "Wajahat Abbas" <wajahatabbas@.yahoo.com> wrote in message
> news:DF2E7E87-9B3A-41D6-BA78-42226C2C5752@.microsoft.com...
> > Hello Arapi,
> > Though the problem you have written may have number of reasons, but i
feel
> > like that there is something which you make a reference on your
> > development
> > machine is not present on the host machine.
> > Check out all the references you made, there respective dll;s are
present
> > as
> > well as in the hosting machine.
> > --
> > Wajahat Abbas
> > http://www.wajahatabbas.com
> > http://www.dotnetpakistan.com
> > "Arapi" wrote:
> >> I am having a very strange problem with my asp.net application. I am
> >> getting error: 'Object reference not set to an instance of an object'
> >> when I
> >> run my app from my hosting company. I have installed my application on
> >> three different machines (including a brand new install of winxp,
vs2003)
> >> at
> >> our offices and everything seems to work fine. What could be wrong
with
> >> the
> >> server at hosting company. When i speak to them about the problem they
> >> point the finger at my script, which I think is not a problem because
it
> >> works fine everytime I install it. I really need help with this
problem.
> >> Thanks.
> >>
> >> Arben
> >>
> >>
> >>
> What could be wrong with the server at hosting company. When i speak to
> them about the problem they point the finger at my script, which I think
> is not a problem because it works fine everytime I install it. I really
> need help with this problem.

Do you program with that logic? You don't know where it's been! ;-)

Let me explain, if I may. You say you're getting an exception: "Object
reference not set to an instance of an object." This exception means that
some code in your app is referencing an object which does not exist. For
example, you create a variable, using a method, which returns null
(Nothing), and then, without checking to see whether it is nothing, you
attempt to use it as if it were the object you expect it to be.

Now, you posted no other information about this exception, such as where in
your application it occurred, which can be obtained from the Exception
thrown, using a Stack Trace. This is the first step to diagnosing your
problem. You need to identify the page that contained the line in your code
that threw the exception, and the line of code itself. Next, you need to
identify the object references in that line of code, and work backwards from
each one, identifying what operation(s) might cause that object reference to
be null (Nothing). The easiest way to do this is to implement structured
exception handling (Try/Catch), and using whatever means you choose to pass
the exception information to you, such as logging it, writing it to a file,
or displaying it in the page (which may be the only possible method on a
hosted web site, depending on your permissions).

Knowing what operation caused the object reference to be null (Nothing) will
determine the cause of the issue, and more importantly, what you need to do
to prevent it.

Assuming with no information that the fault somehow lies with your hosting
service environment, simply because you haven't managed to reproduce it on
your local development machine is a gigantic leap of illogical assumption!

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.

"Arapi" <aarapi@.gmail.com> wrote in message
news:%23HSKidduFHA.2076@.TK2MSFTNGP14.phx.gbl...
>I am having a very strange problem with my asp.net application. I am
>getting error: 'Object reference not set to an instance of an object' when
>I run my app from my hosting company. I have installed my application on
>three different machines (including a brand new install of winxp, vs2003)
>at our offices and everything seems to work fine. What could be wrong with
>the server at hosting company. When i speak to them about the problem they
>point the finger at my script, which I think is not a problem because it
>works fine everytime I install it. I really need help with this problem.
>Thanks.
> Arben

0 comments:

Post a Comment