Server Error Object reference not set to an instance of an object

I am using Visual Studio 2005. I have a asp.net application that works fine on my development PC. But when I publish the application and copy the files to the production server, I get a "Server Error Object reference not set to an instance of an object" whenever I try to navigate to any .ASPX webform.

The Stack Trace is vague. However, I believe the problem has something to do with this call I perform in every webform's Page_Load:
      string MyString = WebConfigurationManager.AppSettings["mysetting"];

I perform this call in every webform and every webform gives the above error on the production server. However, there is 1 webform that does not issue the WebConfigurationManager.AppSettings["mysetting"]; in the Page_Load or anywhere else and this 1 webform works fine in the production environment.

What would be the reason that issuing WebConfigurationManager.AppSettings["mysetting"]; would cause the above error?

FYI, the production server is Win2003Server. Development is XP Pro.

Thanks,

Jerry

0
jerry
8/18/2008 5:31:29 PM
asp.net.config-deploy 12495 articles. 0 followers. Follow

1 Replies
996 Views

Similar Articles

[PageSpeed] 19

Jerry,

I assume you've already double-checked that the web.config file is where it's supposed to be on the production server...  You can always do something like this:

if (WebConfigurationManager.AppSettings == null || WebConfigurationManager.AppSettings.Count == 0)
  Trace.Write("Cannot access custom applications settings.");

I assume WebConfigurationManager is a custom implementation of ConfigurationManager?  If so, there might be a problem in its implementation.  Sorry, I wouldn't be able to help you there without seeing some code first...

Hope this helps.


Igor
my blog

[If this post answers your question, I would appreciate your marking it as "Answer"]
-- Deus est ergo cogito.
0
igor
8/18/2008 9:20:42 PM
Reply:

Similar Artilces:

Object reference not set to an instance of an object. System.NullReferenceException: Object reference not set to an instance of an object.
Here's the scenario I have a running code in my localhost using windows xp with microsoft visual studio .net 2003 installed. No problem running the application. But when I transfered the application to a windows server no microsoft visual studio .net 2003 installed. i encountered Object reference not set to an instance of an object. 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 ref...

ActiveDirectoryMembershipProvider
I've spent a week plus searching link afte link on people using the ActiveDirectoryMembershipProvider. Grabbing Roles (Groups) from AD no problem, but actually getting User Information with Membership.GetUser? Fails everytime. In the end I ended up followng the steps in this blog post (http://blogbybob.com/archive/2007/03/09/active-directory-membership-and-roles-in-asp-net-2-0.aspx ) Problem is with: <add name="ADMembershipProvider" applicationName="/" type="System.Web.Security.ActiveDirectoryMembershipProvider" connectionStringName="ADConne...

Server error: Object reference not set to an instance of an object
My install was complete then the inevitable happened.  I deleted my portal when i thought i was deleting a new page I added.  What have I done? Object reference not set to an instance of an object. 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.Source Error: An unhandled exception was generated during the execution o...

Error deploying: Object reference not set to an instance of an object
I am attempting a test deployment of my first ASP.Net application.  I created an IIS virtual directory (which points to my development directory for now), set it to use ASP.Net 2.0, and ran aspnet_regiis -ga IWAM_mymachine.  I am now getting an error which appears to be about authentication (which I'm not using) and is not in my code so I don't know how to track it down.  Suggestions would be appreciated.  Thanks... -- jeff Object reference not set to an instance of an object. Description: An unhandled exception occurred during...

Error: "Object reference not set to an instance of an object" at the Server
Hi guys,   I had never worked with Crystal Reports before, this is my first big web project with ASP.NET/VB.NET and I’m using crystal reports to create the reports, they are working fine at the workstation, but at the server I’m getting an “Object reference not set to an instance of an object.” error.   The project was copied over to the server, no installation; virtual directory path is a directory somewhere in the server. I tried copying  Crystal dll’s to the application \bin directory but I'm still getting the same error.   I really need help with this issue, the...

Server error: "Object reference not set to an instance of an object."
Hello. I'm creating an AJAX Accordion control that pulls in a list of colleges and programs from a university database and creates the accordion panes at runtime. That is all well and good. The problem I'm having is the first row of the data table isn't coming in. The code is below. I suspect the bolded lines are causing the problem. Basically, the first time through the loop, rowCount = 1 and since that rowCount > 1 condition isn't met, the loop isn't executing. Additional times through the loop work correctly. If I change the loop condition to be rowCount >= 1 (or...

Object reference not set to an instance of an objecObject reference not set to an instance of an object.
Hey, I am trying to get the value of the checkbox without_prices in the page_Load, i got this error: Server Error in '/' Application. Object reference not set to an instance of an object. 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.---------------------------------------------------------------------------------------------------...

Object reference not set to an instance of an object , error when deployed in IIS 6.0
 Hi all , i have deployed the VS 2008 site in IIS 6.0 ,when i open the page i get the following error Object reference not set to an instance of an object.this site runs fine locally in .net . please help , thanks in advance ,ashok.c Which line causes the error?Thanks,MaxLet Me Google That For You! Object reference not set to an instance of an object.is the error , when i open the page after i deploy the site in iis .  Hi, Can you post the whole error page screen shot?So that we can identify which part of the code is causing error.. Please: Don't forget to...

Please help me: DotNetNuke.Services.Exceptions.ModuleLoadException: Object reference not set to an instance of an object. ---> System.NullReferenceException: Object reference not set to an instance of
I'm using Dotnetnuke v3.2, when add 1 module, I got this error   "Error: Edit is currently unavailable.    DotNetNuke.Services.Exceptions.ModuleLoadException: Object reference not set to an instance of an object. ---> System.NullReferenceException: Object reference not set to an instance of an object. at DanPhong.DNN.Modules.DDTS.DDTSEdit.btnAddNew_Click(Object sender, EventArgs e) in d:\dnn3\desktopmodules\ddts\ddtsedit.ascx.cs:line 95 --- End of inner exception stack trace ---"Please help....How will I fix this error?  Thanx! Looking at the error y...

The popular error
Object reference not set to an instance of an object error -------------------------------------------------------------------------------- Okay here is my story. I have a list of sales items using a grid control. I have added a few lines of code to the ascx file to control the display of a checkbox according to a value "intSalesItemCDUpgradeID" that is returned from a stored proc. I have got the desired result that I want displayed but now I need the add function for the Add button to act accordingly depending on what the value of "intSalesItemCDUpgradeID" is. ...

Server Error: Object reference not set to an instance of an object. Trying to upload image in database
Does any one has any clue for this error ? I did went through a lot of articles on this error but none helped . I am working in Visual studie 2005 and trying to upload image in sql database through a simple form. Here is the code   using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Data.SqlClient; using System.Web.Configuration; using System.IO; ...

Object reference not set to an instance of an object Error when calling Conn. String in Web.Config
I have two classes: BLL_Document and DAL_Document. The  ObjectDataSource in Document.aspx calls the SelectMethod in BLL_Document to retrieve data; the BLL in turn calls the DAL_Document to get the data from the database. The connection string used in the DAL is saved in Web.Config. The problem is: I got the following error when the  ObjectDataSource calls the BLL:Object reference not set to an instance of an object. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the e...

when deploying website I get "Object Reference not set to an instance of an object" error
I have developed a website in Visual Studio 2003.  The site runs fine locally on my PC but when I compile it in debug mode and copy it to a (remote) staging server I get the above message: Error in: http://stageservername/sso/login.aspxError Message: Object reference not set to an instance of an object.Stack Trace:at Travel.login.btnLogin_Click(Object sender, ImageClickEventArgs e) in c:\inetpub\wwwroot\localprojectaddress\travel\sso\login.aspx.cs:line 292 at           System.Web.UI.WebCo...

Switching from development server to IIS gives "Error: Object reference not set to an instance of an object"
Hi all,    I've been beating my head against the wall for three days now with this and it's more than likely going to be something really silly but I'm a man on the edge! :)  I have written a very simple app to test running reports via a web browser using visual weeb developer express 2008. It all works perfectly well when I run it from the little develpment/test server that runs when you debug but if I then copy the site to my IIS sever i get the error: Load Report Failed CrystalReportViewer - CrystalReportViewer1 Error: Object reference not se...

Web resources about - Server Error Object reference not set to an instance of an object - asp.net.config-deploy

Wikipedia talk:Reference desk/Guidelines/Medical advice - Wikipedia, the free encyclopedia
I disagree with this implication that this section of the guideline represents the consensus. If you look at the last few years of discussion ...

Child sex abuse royal commission: Senior politician to be grilled over reference
A former deputy Premier will again take the stand on Tuesday to explain why he gave a positive job reference to a man he knew to have sexually ...

Reference Pricing tweak for Medicaid
Reference pricing is a common payment reform for commercial insurance. Common, non-urgent, deferrable procedures are prime candidates. Hip replacement ...

10 of the best movie references you’ll ever see in popular TV shows
I'm torn when it comes to breaking the fourth wall in TV shows . It can be a fun, clever way to connect with the audience, but it can also break ...

'Enough with the Viagra references,' says the CEO behind the first FDA approved drug to boost women's ...
... the Fortune Most Powerful Women Next Gen conference. But the reaction to the pill still confounded her. "Enough already with the Viagra references," ...

Donald Trump prompts Nazi references
Some conservatives and political commentators say the GOP frontrunner's rhetoric has crossed the line

Arrow: Easter Eggs and DC Comics References in "Brotherhood"
This was a weird week for Arrow, in terms of the crazy minutia we generally look for.There were a [...]

Now you can bookmark Google image searches for later reference
Normally, image searches on Google are ephemeral things and gone the moment you close the browser tab. However, a new feature on the search giant's ...

The 5 Best Britney Spears References From Her 'Jane the Virgin' Visit
The 5 Best Britney Spears References From Her 'Jane the Virgin' Visit

How To Get the References You Need For the Job You Really Want
How To Get the References You Need For the Job You Really Want

Resources last updated: 12/10/2015 7:20:08 AM