[英]The provider did not return a ProviderManifestToken string
I know there are several questions with this problem and I've checked pretty much every single one and I still have the same issue. 我知道这个问题有几个问题,我检查了几乎每个问题,但仍然遇到同样的问题。
I have an API that I published to IIS. 我有一个发布到IIS的API。 However, I can't use the connection string properly it seems, as when I run the update-database command targeting that connection string I get the following error:
但是,似乎无法正确使用连接字符串,因为当我针对该连接字符串运行update-database命令时,出现以下错误:
System.Data.Entity.Core.ProviderIncompatibleException: An error occurred accessing the database.
System.Data.Entity.Core.ProviderIncompatibleException:访问数据库时发生错误。 This usually means that the connection to the database failed.
这通常意味着与数据库的连接失败。 Check that the connection string is correct and that the appropriate DbContext constructor is being used to specify it or find it in the application's config file.
检查连接字符串是否正确,是否使用了适当的DbContext构造函数来指定它或在应用程序的配置文件中找到它。 See http://go.microsoft.com/fwlink/?LinkId=386386 for information on DbContext and connections.
有关DbContext和连接的信息,请参见http://go.microsoft.com/fwlink/?LinkId=386386 。 See the inner exception for details of the failure.
有关失败的详细信息,请参见内部异常。 ---> System.Data.Entity.Core.ProviderIncompatibleException: The provider did not return a ProviderManifestToken string.
---> System.Data.Entity.Core.ProviderIncompatibleException:提供程序未返回ProviderManifestToken字符串。 ---> System.Data.SqlClient.SqlException: A network-related or instance-specific error occurred while establishing a connection to SQL Server.
---> System.Data.SqlClient.SqlException:建立与SQL Server的连接时发生与网络相关或特定于实例的错误。 The server was not found or was not accessible.
服务器未找到或无法访问。 Verify that the instance name is correct and that SQL Server is configured to allow remote connections.
验证实例名称正确,并且已将SQL Server配置为允许远程连接。 (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
(提供者:SQL网络接口,错误:26-指定服务器/实例时出错)
This is my connectionString; 这是我的connectionString;
<add name="ApplicationDbContext" connectionString="Data Source=WVM002\SQLEXPRESS;Initial Catalog=ImobiliariaARQSI_v01;User ID=sa;Password=password;Persist Security Info = True;" providerName="System.Data.SqlClient"/>
And this is the context: 这是上下文:
public ApplicationDbContext() : base("ImobiliariaARQSI_v01", throwIfV1Schema: false)
{
}
I set up the ports on SQL Server on the other machine hosting the instance and it is recognized. 我在托管实例的另一台计算机上的SQL Server上设置了端口,并且可以识别该端口。 The problem is in the connectionstring probably.
问题可能出在连接字符串中。 Help please.
请帮助。
在构造函数中,您要传递数据库名称ImobiliariaARQSI_v01 ,而不是根据.config的连接字符串名称:
public ApplicationDbContext() : base("ApplicationDbContext", throwIfV1Schema: false){}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.