asp.net-mvc – ELMAH和SQL Server 2008 R2?

前端之家收集整理的这篇文章主要介绍了asp.net-mvc – ELMAH和SQL Server 2008 R2?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我尝试使用我的ASP.NET MVC 2项目运行 ELMAH但是有一些问题可以让它与我的sql Server 2008 R2数据库一起使用.

这就是我所做的.

>在我的数据库中运行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=&quot;Data Source=000.000.000.000;Initial Catalog=MyDatabase;Persist Security Info=True;User ID=[username];Password=[password];MultipleActiveResultSets=True&quot;" 
     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

我究竟做错了什么?

解决方法@H_403_53@
实体框架连接字符串与sqlclient连接字符串不同,它们不兼容.您必须使用sqlclient连接字符串才能与elmah一起使用.
查看此站点获取有效的连接字符串: http://connectionstrings.com/sql-server-2008

原文链接:https://www.f2er.com/aspnet/245289.html

猜你在找的asp.Net相关文章