System.InvalidOperationException: The ConnectionString property hasnot been initialized.

Q

QC

Hi,

this morning found that my Service had crashed, and the error was
"Exception Details: System.InvalidOperationException: The
ConnectionString property has not been initialized". I have no clue
WHY the ConnectionString wouldn't be initialized as I do not play with
anything near it in my code. my service is running perfectly from last
few years, and the same code executed millions of time. I am using VS
2003, .net 1.1.
Do you have any pointer on why this error would happen? Thanks a lot.

Here's the exception:

System.InvalidOperationException: The ConnectionString property has
not been initialized.
at System.Data.SqlClient.SqlConnection.Open()
 
M

Marc Gravell

Well, what changed? Where is the connection string held?
If it is in the configuration file (which would be common), does the
config file still exist? Is it in the right location? Has anybody been
renaming / moving files? etc

And finally - are you *sure* that there isn't a rarely used (i.e. now)
branch of code that might not have been used in ages, and that this
may simply have a bug?

Marc
 
Q

QC

Well, what changed? Where is the connection string held?
If it is in the configuration file (which would be common), does the
config file still exist? Is it in the right location? Has anybody been
renaming / moving files? etc

And finally - are you *sure* that there isn't a rarely used (i.e. now)
branch of code that might not have been used in ages, and that this
may simply have a bug?

Marc

Yes, connection string is in Config File, and there were no changes
like rename, not exist etc. all things were same.
 
Q

QC

Also, in simple way, if there is any changes in Config file, the error
would be at different place, like Node not found / file not found /
Cannot access the file etc.
so the problem is not from the config file, it is from somewhere else,
right?

the same code i used to create the connection, the same code hits
almost 10000+ times daily, so what would be problem?
 
M

Marc Gravell

Also, in simple way, if there is any changes in Config file, the
error
would be at different place
Not if your connection-string lookup code is swallowing the exception
and returning ""...
so what would be problem?
Can't answer that without more detail... such as how you think it gets
set... to be honest, I think you need to trace it throught from
there... somehow it is setting the cs to an empty string, but only the
code can tell you why...

Marc
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top