从数据库获取提供程序信息时发生错误。这可能是因为Entity Framework使用了不正确的连接字符串引起的。检查内部异常以获取详细信息,并确保连接字符串正确。
内部异常:{"The provider did not return a ProviderManifestToken string."}
我在其他线程上搜索了许多类似错误的情况,但似乎找不到解决方案。
我正在使用VS2012专业版和SQL Server 2012。我能够使用Windows身份验证通过服务器资源管理器连接到服务器。我正在构建一个包含多个层次结构的WebForms应用程序。其中之一包含我的Entity Framework层,其中包含我的Context类。
<?xml version="1.0"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
</system.web>
<connectionStrings>
<add name="MYSQLSERVER"
providerName="System.Data.SqlClient"
connectionString="Data Source=myComputer\MYSQLSERVER;Trusted_Connection=true"></add>
</connectionStrings>
</configuration>
这是我 Entity Framework 类库层中的 app.config 的样子。
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="v11.0" />
</parameters>
</defaultConnectionFactory>
</entityFramework>
</configuration>
同时,我尝试将app.config文件中的defaultConnectionFactory类型更改为
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework">
但这并没有改变任何事情。
我真的不确定我所做的任何更改意味着什么,这让我感到担忧。当然,我可以在网上找到解决方案并修复我的问题,但我真的很想了解web.config以及所有这些意味着什么。除了找到解决这个问题的方法外,有人能指点我学习web.config的正确方向吗?
提前感谢您的帮助。