Monday, March 26, 2012

The connection name ConnectionString was not found in the applications configuration or th

Hi All, I need help. I am developing a very simple ASP.NET Application that retreived some information from an Oracle Database.

The application was working fine, but suddenly it stopped working with the following exception:

"The connection name 'ConnectionString' was not found in the applications configuration or the connection string is empty."

Furthermore, I had backups of the application on my hard drive, and all suddenly stopped working with the same exception. I beieve it is a general Configuration issue ... because all the connections are failing with the same exception.

Following is the excepton, and the line where the exception is given:

Line 55:
Line 56:
Line 57: <asp:SqlDataSource ID="SqlDataSource42" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString42%>"
Line 58: ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>"
Line 59: SelectCommand="Select * from TBORDER_ACTION where customer_id = 'XYZ'">

And again the exception is "The connection name 'ConnectionString' was not found in the applications configuration or the connection string is empty."

Following is my Web.config:

<?xmlversion="1.0"?><!--

Note: As an alternative to hand editing this file you can use the

web admin tool to configure settings for your application. Use

the Website->Asp.Net Configuration option in Visual Studio.

A full list of settings and comments can be found in

machine.config.comments usually located in

\Windows\Microsoft.Net\Framework\v2.x\Config

-->

<configurationxmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">

<connectionStrings>

<addname="ConnectionString42"connectionString="Data Source=DatabaseInstance;User ID=Username42;Password=Password42;Unicode=True"providerName="System.Data.OracleClient" />

<addname="ConnectionString42m"connectionString="Data Source=DatabaseInstance;User ID=Username;Password=Password42;Unicode=True"

providerName="System.Data.OracleClient" />

</connectionStrings>

<system.web>

<!--

Set compilation debug="true" to insert debugging

symbols into the compiled page. Because this

affects performance, set this value to true only

during development.

Visual Basic options:

Set strict="true" to disallow all data type conversions

where data loss can occur.

Set explicit="true" to force declaration of all variables.

-->

<compilationdebug="true"strict="false"explicit="true"/>

<pages>

<namespaces>

<clear/>

<addnamespace="System"/>

<addnamespace="System.Data"/>

<addnamespace="System.Collections"/>

<addnamespace="System.Collections.Specialized"/>

<addnamespace="System.Configuration"/>

<addnamespace="System.Text"/>

<addnamespace="System.Text.RegularExpressions"/>

<addnamespace="System.Web"/>

<addnamespace="System.Web.Caching"/>

<addnamespace="System.Web.SessionState"/>

<addnamespace="System.Web.Security"/>

<addnamespace="System.Web.Profile"/>

<addnamespace="System.Web.UI"/>

<addnamespace="System.Web.UI.WebControls"/>

<addnamespace="System.Web.UI.WebControls.WebParts"/>

<addnamespace="System.Web.UI.HtmlControls"/>

</namespaces>

</pages>

<!--

The <authentication> section enables configuration

of the security authentication mode used by

ASP.NET to identify an incoming user.

--> <authenticationmode="Windows"/>

<!--

The <customErrors> section enables configuration

of what to do if/when an unhandled error occurs

during the execution of a request. Specifically,

it enables developers to configure html error pages

to be displayed in place of a error stack trace.

<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">

<error statusCode="403" redirect="NoAccess.htm" />

<error statusCode="404" redirect="FileNotFound.htm" />

</customErrors>

--> </system.web>

</configuration>

Please help; I have been stuck with this issue for 1 week...

You have two connections strings with the same name. Is that the problem?


No - I have 2 connection string with 2 different names.

Please advice,

Mahdi


Line 57: <asp:SqlDataSource ID="SqlDataSource42" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString42%>"
Line 58: ProviderName="<%$ ConnectionStrings:ConnectionString42.ProviderName %>"



Dear jfmccarthy,

You are number 1; You are the best. I have been trying 3 days to find an answer, explored many sites, and spent more than 30 hours but could not find the answer.

Your suggestion was correct. I want to realyyyy... thank you, and wish you much success in your life (Although I am sure you are successfull).

Thanks Thanks Thanks...Big Smile


Well thank you very muchEmbarrassed

0 comments:

Post a Comment