Unable to read from my App.config

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a windows app in a virtual folder which works great on my test server.
However, when I move the application to a production server I get the
following error :

An unhandled error has occured in your application. Object not set to an
instance of an object.

This only occurs when I try to read my connection string from my app.config
file :
lconnstr='System.Configuration.ConfigurationSettings.AppSettings("MyConnString").ToString

Any ideas why I cannot read from my app.confog on one server but not on the
other server ?
 
poppy said:
I have a windows app in a virtual folder which works great on my test
server.
However, when I move the application to a production server I get the
following error :

An unhandled error has occured in your application. Object not set to an
instance of an object.

This only occurs when I try to read my connection string from my
app.config
file :
lconnstr='System.Configuration.ConfigurationSettings.AppSettings("MyConnString").ToString

Any ideas why I cannot read from my app.confog on one server but not on
the
other server ?

Visual Studio copies your App.config file to the build output directory and
renames it to YourAppName.exe.config. Do you have a file with the correct
name on your production server?
 
My App.Config has the same name as my Application.

Does changing the folder name that the application resides in cause problems
? I dont see why.
 
poppy said:
My App.Config has the same name as my Application.

Does changing the folder name that the application resides in cause
problems
? I dont see why.

I've never seen a problem caused by moving the executable and config file.
Do you have an appSetting with a key of "MyConnString"? Can you post your
config file?
 
Back
Top