Friday, April 27, 2012

Expecting non-empty string for 'providerInvariantName' parameter - database connection error in asp.net web application

Just a simple accidental error in asp.net web application's web.config file, and you see the following error:

Expecting non-empty string for 'providerInvariantName' parameter. 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.ArgumentException: Expecting non-empty string for 'providerInvariantName' parameter.
Fig. 1 Error page showing providerInvariantName parameter error for asp.net web application's database connection error
 The error occurred only because I had missed the providerName property in my connection string.
My connection string is:
<connectionStrings>
  <add name="ConnectionString" connectionString="data source=my-pc;Integrated Security=true;Initial Catalog=mydbname"
   providerName="System.Data.SqlClient" />
  </connectionStrings>
And accidentally it was broken like:
<connectionStrings>
  <add name="ConnectionString" connectionString="data source=my-pc;Integrated Security=true;Initial Catalog=mydbname" />
  </connectionStrings>
I was stunned to get the error when I had just finished uploading the web application to my host. After some googling, I found the cause and fixed the error. It worked. Happy programming!

0 comments:

Post a Comment

Hope you liked this post. You can leave your message or you can put your valuable suggestions on this post here. Thanks for the sharing and cooperation!

Popular Posts

Recent Articles