这就是我所做的.
>在我的数据库中运行dbscript,不小心我运行了两次,但在这种情况下似乎并不重要.
>将以下部分添加到我的web.config(在configSection下):
<elmah> <errorLog type="Elmah.sqlErrorLog,Elmah" connectionStringName="MyEntities" /> </elmah>
>这是我的Entity Framework连接字符串的样子:
<add name="MyEntities" connectionString="Metadata=res://*/Models.Model.MyEntities.csdl|res://*/Models.Model.MyEntities.ssdl|res://*/Models.Model.MyEntities.msl;provider=System.Data.sqlClient;provider connection string="Data Source=000.000.000.000;Initial Catalog=MyDatabase;Persist Security Info=True;User ID=[username];Password=[password];MultipleActiveResultSets=True"" providerName="System.Data.EntityClient" />
访问admin / elmah /页面时,我收到以下异常:
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) +5110868
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
我究竟做错了什么?
解决方法
查看此站点以获取有效的连接字符串: http://connectionstrings.com/sql-server-2008