Random Error 500 "ConnectionString Property Was Not Initialized"

I use the same ConnectionString, since our site connected to the network in July 2010 and there have never been any problems connecting and interacting with our database.
However, starting in July 2011, I continue to receive random "ConnectionString properties failed to initialize."

  • How does the error happen?

Our site works perfectly for a variable period of time (from several hours to several weeks, although I noted that today it is more than a few hours), which means that queries with work in the database are wonderful, people can log in, etc. . And then at some point a connectionString error will occur.
From this moment, our site becomes inaccessible and continues to return this error for any page that we are trying to access.
Sometimes, after 10-15 million, our site returns online again, and works fine until the error appears again. But most of the time I have to use one of the following three methods so that it works again:

1) Saving the web configuration file again, without adding / modifying anything

2) Stop and start the site in IIS
3) Server reboot

Our server also has a development site. However, he never threw me this random mistake. The only differences between our development site and the production site are the various databases, sql users, and authentication modes in Web Config (production = Windows, development = forms)

  • What has changed since July 2010 on our server?
Frame

.net was updated from March 3.5 to March 4, 2011.
The physical directory of the site has been moved from the IIS source directory to another partition on the same server since June 2011 (basically it’s just cutting / pasting the site directory and changing the physical path of the application in IIS).
Windows Server 2008 updates are applied whenever there are some.

  • What did I try to fix?

1) Firstly, I again tried to return the site directory to IIS inetpub / wwwroot. This has not changed anything.
2) I tried to establish the same catalog rights on our production site as on our development site. Still nothing.
3) I compared the development / production of two application pools, but there are no differences.
4) And, of course, I searched on numerous sites to find out if anyone was faced with this problem. The most related topic for my problem that I found is: Web.config - ConnectionString property was not initialized
However, I do not understand how I can check the "randomly applied permissions on my Internet root folder."

  • Stack trace on the main page when an error occurs :
at System.Data.SqlClient.SqlConnection.PermissionDemand() at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) at System.Data.SqlClient.SqlConnection.Open() at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet) at Database.listeCategories(enuTypeCategorie typeCategorie, enuOrdre ordre, enuActif actif, Boolean withFirstRow, Boolean libTous) at user_controls_criteresAnnonce.set_secteur(Int32 value) at user_controls_criteresAnnonce.initValues() at _default.Page_Load(Object sender, EventArgs a) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) 

Since an error applies to any page when it pops up, the source is always different.

  • System Information :

Sites (development and production) run on Windows Server 2008 SP2 with IIS 7.
The database runs under SQL Server 2005.
.NET framework - 4 (ASP version is written in Server Manager: ASP.NET 4.0.30319.0).

ConnectionString is stored in the Web Config file with the following template:

 <connectionStrings> <add name="BosstobossDbBase" connectionString="Server=server_ip; Database=database_name; User=login; password=pass" providerName="System.Data.SqlClient"/> </connectionStrings> 

And before any attempt to connect to the database, connectionString affects a SqlConnection object like this (conn is declared in the class):

 conn = New SqlConnection() conn.ConnectionString = ConfigurationManager.ConnectionStrings("BosstobossDbBase").ConnectionString conn.Open() 

If you need more information, please feel free to ask me. I am at a loss with this ... Any help would be happy to be received.
Thanks!

Yours faithfully,
Kevin

+4
source share
2 answers

I would modify the web.config file and see if it helps:

  <connectionStrings> <remove name="BosstobossDbBase" /> <add name="BosstobossDbBase" connectionString="Server=server_ip; Database=database_name;User=login; password=pass" providerName="System.Data.SqlClient"/> </connectionStrings> 
0
source

I encountered the same problem for a long time. I had an application on ASP.Net v2.0 that worked fine, and suddenly one day I started getting this error.

I solved it as follows:

Open inetmgr and click on the core server. In the Features view, click ConnectionStrings. In my case, there were two connection strings that were inherited by all applications. It turned out that one of the lines was invalid, and when I deleted it, everything was in order.

One of the users of this machine added this line some time ago, which broke all applications.

Hope this helps.

0
source

All Articles