提供程序未返回ProviderManifestToken字符串 [英] The provider did not return a ProviderManifestToken string

查看:154
本文介绍了提供程序未返回ProviderManifestToken字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道这个问题有几个问题,我检查了几乎每个问题,但仍然有同样的问题。

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.

我有一个API我发布到IIS。但是,我似乎无法正确使用连接字符串,因为当我针对该连接字符串运行update-database命令时,出现以下错误:

I have an API that I published to IIS. 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:


System.Data.Entity.Core.ProviderIncompatibleException:访问数据库时发生错误。这通常意味着与数据库的连接失败。检查连接字符串是否正确,以及是否使用了适当的DbContext构造函数来指定它或在应用程序的配置文件中找到它。请参阅 http://go.microsoft.com/fwlink/?LinkId=386386 有关DbContext和连接的信息。有关失败的详细信息,请参见内部异常。 ---> System.Data.Entity.Core.ProviderIncompatibleException:提供程序未返回ProviderManifestToken字符串。 ---> System.Data.SqlClient.SqlException:建立与SQL Server的连接时发生与网络相关或特定于实例的错误。服务器未找到或无法访问。验证实例名称正确,并且已将SQL Server配置为允许远程连接。 (提供者:SQL网络接口,错误:26-指定服务器/实例时出错)

System.Data.Entity.Core.ProviderIncompatibleException: An error occurred accessing the database. 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. See http://go.microsoft.com/fwlink/?LinkId=386386 for information on DbContext and connections. See the inner exception for details of the failure. ---> System.Data.Entity.Core.ProviderIncompatibleException: The provider did not return a ProviderManifestToken string. ---> System.Data.SqlClient.SqlException: A network-related or instance-specific error occurred while establishing a connection to 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. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)

这是我的connectionString;

This is my 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"/>

这是上下文:

public ApplicationDbContext() : base("ImobiliariaARQSI_v01", throwIfV1Schema: false)
    {
    }

我在托管实例的另一台计算机上的SQL Server上设置了端口,并且该端口被识别。问题可能出在连接字符串中。
请帮助。

I set up the ports on SQL Server on the other machine hosting the instance and it is recognized. The problem is in the connectionstring probably. Help please.

推荐答案

在构造函数中,您传递的数据库名称是 ImobiliariaARQSI_v01 ,而不是按照.config设置连接字符串名称:

In the constructor you are passing the dababase name ImobiliariaARQSI_v01, instead of the connection string name as per .config:

public ApplicationDbContext() : base("ApplicationDbContext", throwIfV1Schema: false){}

这篇关于提供程序未返回ProviderManifestToken字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆