Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Web application runtime error
Message
De
01/04/2015 22:08:33
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Titre:
Web application runtime error
Versions des environnements
Environment:
C# 4.0
OS:
Windows 7
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01617669
Message ID:
01617669
Vues:
29
Using security module. I have the following code in the UserLogin.aspx.cs file.
public override void HookUserAuthenticated(object userPK)
{
    User uo = new User();
    UserEntity ue = uo.GetUserByUserPK((int)userPK);
    ue.LastLogin = System.DateTime.Now;
    ue.FailedTries = 0;
    mmSaveDataResult result = uo.SaveEntity(ue);
    base.HookUserAuthenticated(userPK);
}
The User object, User.Partial.cs, has the following code:
public UserEntity GetUserByUserPK(int userPK)
{
	IQueryable<UserEntity> query = from user in this.ObjectContext.UserEntities
								 where user.UserPK == userPK
								 select user;
	return this.GetEntity(query);
}
Web.config in web project and App.config in object model project both have the following database settings.
	<databases>
		<add key="LotteryPool\Connection" value="server=localhost;Integrated Security=SSPI;Initial Catalog=LotteryPool;" />
		<add key="LotteryPool\DataAccessClass" value="DataAccessSql" />
		<add key="EntityDataModelContainer\DataAccessClass" value="DataAccessSqlEF" />
	</databases>
When the Linq code is executed in GetUserByUserPK I get the following error:
Server Error in '/LotteryPool' 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 49:         /// Initializes a new EntityDataModelContainer object using the connection string found in the 'EntityDataModelContainer' section of the application configuration file.
Line 50:         /// </summary>
Line 51:         public EntityDataModelContainer() : base("name=EntityDataModelContainer", "EntityDataModelContainer")
Line 52:         {
Line 53:             OnContextCreated();
  

 Source File:  C:\mm.net\Lottery Pool Business Objects\EntityDataModel.cs    Line:  51 

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) +8420466
   System.Data.EntityClient.EntityConnection..ctor(String connectionString) +43
   System.Data.Objects.ObjectContext.CreateEntityConnection(String connectionString) +85
   System.Data.Objects.ObjectContext..ctor(String connectionString, String defaultContainerName) +16
   ShawnsLuck.LotteryPool.Business.EntityDataModelContainer..ctor() in C:\mm.net\Lottery Pool Business Objects\EntityDataModel.cs:51
   ShawnsLuck.LotteryPool.Business.User.CreateObjectContext() in C:\mm.net\Lottery Pool Business Objects\User\User.cs:96
   OakLeaf.MM.Main.Business.mmBusinessObjectGeneric`1.get_ObjectContextEF() +89
   ShawnsLuck.LotteryPool.Business.User.get_ObjectContext() in C:\mm.net\Lottery Pool Business Objects\User\User.cs:59
   ShawnsLuck.LotteryPool.Business.User.GetUserByUserPK(Int32 userPK) in C:\mm.net\Lottery Pool Business Objects\User\User.Partial.cs:34
   UserLogin.HookUserAuthenticated(Object userPK) in c:\mm.net\LotteryPool\UserLogin.aspx.cs:69
   OakLeaf.MM.Main.Web.UI.mmBaseUserLogin.Login() +622
   UserLogin.btnLogin_Click(Object sender, EventArgs e) in c:\mm.net\LotteryPool\UserLogin.aspx.cs:39
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +9653178
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +103
   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) +35
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1724

  


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.34237  
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform