簡體   English   中英

ASP.NET登錄控制連接字符串錯誤:不支持關鍵字:'元數據'

[英]ASP.NET login control connection string error : Keyword not supported: 'metadata'

我正在使用正常連接,直到現在,一切都很順利,但現在我已切換到數據實體模型,並使用新的連接字符串,我有這個錯誤...我如何保持我的實體字符串為我的數據操作和使用常規conn string僅用於登錄控制?

Keyword not supported: 'metadata'.
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: Keyword not supported: 'metadata'.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[ArgumentException: Keyword not supported: 'metadata'.]
   System.Data.Common.DbConnectionOptions.ParseInternal(Hashtable parsetable, String connectionString, Boolean buildChain, Hashtable synonyms, Boolean firstKey) +5055124
   System.Data.Common.DbConnectionOptions..ctor(String connectionString, Hashtable synonyms, Boolean useOdbcRules) +98
   System.Data.SqlClient.SqlConnectionString..ctor(String connectionString) +64
   System.Data.SqlClient.SqlConnectionFactory.CreateConnectionOptions(String connectionString, DbConnectionOptions previous) +24
   System.Data.ProviderBase.DbConnectionFactory.GetConnectionPoolGroup(String connectionString, DbConnectionPoolGroupOptions poolOptions, DbConnectionOptions& userConnectionOptions) +150
   System.Data.SqlClient.SqlConnection.ConnectionString_Set(String value) +59
   System.Data.SqlClient.SqlConnection.set_ConnectionString(String value) +4
   System.Data.SqlClient.SqlConnection..ctor(String connectionString) +26
   System.Web.DataAccess.SqlConnectionHolder..ctor(String connectionString) +54

[ArgumentException: An error occurred while attempting to initialize a System.Data.SqlClient.SqlConnection object. The value that was provided for the connection string may be wrong, or it may contain an invalid syntax.
Parameter name: connectionString]
   System.Web.DataAccess.SqlConnectionHolder..ctor(String connectionString) +136
   System.Web.DataAccess.SqlConnectionHelper.GetConnection(String connectionString, Boolean revertImpersonation) +119
   System.Web.Security.SqlMembershipProvider.GetPasswordWithFormat(String username, Boolean updateLastLoginActivityDate, Int32& status, String& password, Int32& passwordFormat, String& passwordSalt, Int32& failedPasswordAttemptCount, Int32& failedPasswordAnswerAttemptCount, Boolean& isApproved, DateTime& lastLoginDate, DateTime& lastActivityDate) +827
   System.Web.Security.SqlMembershipProvider.CheckPassword(String username, String password, Boolean updateLastLoginActivityDate, Boolean failIfNotApproved, String& salt, Int32& passwordFormat) +105
   System.Web.Security.SqlMembershipProvider.ValidateUser(String username, String password) +106
   System.Web.UI.WebControls.Login.AuthenticateUsingMembershipProvider(AuthenticateEventArgs e) +60
   System.Web.UI.WebControls.Login.OnAuthenticate(AuthenticateEventArgs e) +129
   System.Web.UI.WebControls.Login.AttemptLogin() +127
   System.Web.UI.WebControls.Login.OnBubbleEvent(Object source, EventArgs e) +101
   System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37
   System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e) +125
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +167
   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

連接字符串

<connectionStrings>
    <add name="LoginDB" connectionString="Data Source=****;Initial Catalog=int422_113b16;User ID=****;Password=****" />
    <add name="BlogEntities" connectionString="metadata=res://*/App_Code.BlogModel.csdl|res://*/App_Code.BlogModel.ssdl|res://*/App_Code.BlogModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source****;initial catalog=int422_113b16;user id=****;password=****;multipleactiveresultsets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
</connectionStrings>

找到了答案......只是理性思考並檢查配置文件我所要做的就是更改provider標簽的connectionStringName

如果有人遇到同樣的問題,請將來參考

我正在開發一個自定義用戶控件,如果我在測試應用程序中使用它,它仍然可以完美無缺但如果我嘗試部署相同的錯誤,我會得到相同的錯誤,我的自定義控件的代碼后面的行以紅色突出顯示我的瀏覽器:

SqlConnection CriminalConnection = new SqlConnection(strConnectionString);

呃:

不支持關鍵字:'元數據'。

下面是堆棧跟蹤的最初幾行:

System.Data.Common.DbConnectionOptions.ParseInternal(Hashtable parsetable,String connectionString,Boolean buildChain,Hashtable synonyms definitions,Boolean firstKey)+5110852
System.Data.Common.DbConnectionOptions..ctor(String connectionString,Hashtable synonyms definitions,Boolean useOdbcRules)+98

原因在我的情況下,連接字符串格式不正確,詳細說明請訪問http://www.connectionstrings.com/

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM