Saturday, March 5, 2011

The specified named connection is either not found in the configuration, not intended to be used with the EntityClient provider, or not valid.

Problem:

Server Error in '/' Application.


The specified named connection is either not found in the configuration, not intended to be used with the EntityClient provider, or not valid.

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: The specified named connection is either not found in the configuration, not intended to be used with the EntityClient provider, or not valid.

Source Error: 
 
Line 32:         /// Initializes a new xxxxEntities object using the connection string found in the 'xxxxEntities' section of the application configuration file.
Line 33:         /// 
Line 34:         public xxxxEntities() : base("name=xxxxEntities", "xxxxEntities")
Line 35:         {
Line 36:             this.ContextOptions.LazyLoadingEnabled = true;

Source File: C:\Users\xxxx\Documents\Visual Studio 2010\Projects\xxxx.Designer.cs    Line: 34 

Stack Trace: 
 
[ArgumentException: The specified named connection is either not found in the configuration, not intended to be used with the EntityClient provider, or not valid.]
   System.Data.EntityClient.EntityConnection.ChangeConnectionString(String newConnectionString) +8080056
   System.Data.EntityClient.EntityConnection..ctor(String connectionString) +81
   System.Data.Objects.ObjectContext.CreateEntityConnection(String connectionString) +42
   System.Data.Objects.ObjectContext..ctor(String connectionString, String defaultContainerName) +16
   xxxx..ctor() in C:\Users\xxxxx.cs:34
   xxxx(Int32 id) in C:\Users\xxx.cs:25
   xxxx() in C:\Users\xxxx\Documents\Visual Studio 2010\Projects\xxxxDal.cs:36
   xxxx() in C:\Users\xxxx\Documents\Visual Studio 2010\Projects\xxxx.cs:13
   xxxx(Object sender, EventArgs e) in C:\Users\xxxxaspx.cs:145
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +118
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +112
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5563



Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1


Solution:
Add the entity connection string to the web.config file in the appropriate project.

1 comment:

  1. As you suggested, I have added the entity connection string to the web.config but still I am receiving this error.

    ReplyDelete