场景:IIS默认站点建立程序,使用Windows集成身份验证方式,连接SQLServer数据库也是采用集成身份验证。我报“System.Data.EntityException: The underlying provider failed on Open.”这个错误是因为计算机登录密码改过,导致之前应用程序池设置的凭证错误,解决办法:把应用程序池的登录凭证也修改一下改成和计算机登录密码一样,这样程序就好了。

步骤:

  新增一个应用程序:

  IIS Default Web Site-->Add Application-->Application Pool-->ASP.NET V4.0 Integrated

  修改应用程序池的凭证:

  Application Pool-->ASP.NET V4.0 Integrated-->Advanced Settings-->Process Model-->Identity-->Customer account-->Set Credentials-->Set UserName=Cumputer LoginName,Password=Cumputer Login Password-->Click OK

  配置文件

<appSettings>
    <add key="CreditCheckGatewayDB" value="Server=fscnbesd0001;Database=CreditCheckGateway;Integrated Security=SSPI;" />
  </appSettings>

  C#读取连接字符串

        static public string GetCupCreditCheckConnectionString
{
get
{
return string.Format("metadata=res://*/CupModel.csdl|res://*/CupModel.ssdl|res://*/CupModel.msl;provider=System.Data.SqlClient;provider connection string=\"{0}\";", ConfigurationManager.AppSettings["CreditCheckGatewayDB"]);
}
}

  或者配置文件直接写

<appSettings>
<add key="CupCreditCheckDB" value="metadata=res://*/CupModel.csdl|res://*/CupModel.ssdl|res://*/CupModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;Server=fscnbesd0001;Database=CreditCheckGateway;Integrated Security=SSPI&quot;" providerName="System.Data.EntityClient" />
</appSettings>
 <connectionStrings>
<add name="CupCreditCheckDB" connectionString="metadata=res://*/CupModel.csdl|res://*/CupModel.ssdl|res://*/CupModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;Server=fscnbesd0001;Database=CreditCheckGateway;Integrated Security=SSPI&quot;" providerName="System.Data.EntityClient" />
</connectionStrings>

    

System.Data.EntityException: The underlying provider failed on Open.的更多相关文章

  1. System.Data.Entity.Core.EntityException: The underlying provider failed on Open. ---> System.InvalidOperationException: 超时时间已到。超时时间已到,但是尚未从池中获取连接。出现这种情况可能是因为所有池连接均在使用,并且达到了最大池大小。

    2017/8/15 20:55:21 [AgentPayQuery_205506102_1BBBB]系统异常:System.Data.Entity.Core.EntityException: The ...

  2. EntityFrame6在本地可以正常使用,部署到IIS后报异常(Additional information: The underlying provider failed on Open.)

    异常详细:An exception of type 'System.Data.Entity.Core.EntityException' occurred in EntityFramework.SqlS ...

  3. asp.net网站运行出错:the underlying provider failed on open的解决

    在登录系统,通过linq查询时发生错误,the underlying provider failed on open,如何解决,请看: Step 1:Open Internet Information ...

  4. The underlying provider failed on Open. EF

    本地测试是可以的:但是放到服务器上就不行了: 报错:"The underlying provider failed on Open." 这一情况和我以前遇上的一次错误有点相似啊:都 ...

  5. 如何解决The underlying provider failed on Open问题

    转自codeproject,找了半天解决办法,这个最靠谱. 我数据库用的EF做ORM,在vs里面测试的时候不会出现这个错误,用IIS就出错了.解决方法如下 Solution for "The ...

  6. 【EF数据库链接报错】“The underlying provider failed on open”

    EF在操作数据库时要反复链接.断开数据库,如果连接字符串是windows 服务验证,而不是用的用户名和密码,那么尝试访问数据库的用户是NT AUTHORITY\NETWORK SERVICE.权限不够 ...

  7. EntityFrame Work:No Entity Framework provider found for the ADO.NET provider with invariant name 'System.Data.SqlClient'

    今天试着学习了Entity Frame Work遇到的问题是 The Entity Framework provider type 'System.Data.Entity.SqlServer.SqlP ...

  8. The Entity Framework provider type 'System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer' registered in the application config file for the ADO.NET provider with invariant name

    可以强迫部署EntityFramework.SqlServer.dll这个文件到输出目录 找到1个老外的帖子,戳这里(本人测试无效,大家有可能试一下..) 解决方案以下: 在EF的上下文代码CS文件( ...

  9. SQL Server System.Data.SqlClient.SqlException:已成功于服务器建立连接,但是在 登录前的握手期间发生错误

    一.错误描述 错误名称如上.整体错误如下: System.Data.EntityException 基础提供程序在Open上失败--> System.Data.SqlClient.SqlExce ...

随机推荐

  1. 解决oracle服务占用内存过高的问题

    其实这是因为安装Oracle时,为了均衡电脑性能和数据库性能,默认内存大小为物理内存的1/8,自身内存比较大时,oracle所占的内存也会变大.而通常,我们自己的环境并不需要分配那么大的内存来支持Or ...

  2. 连接Android模拟器

    一.如何找到adb?    安装夜神安卓模拟器后,电脑桌面会有“夜神模拟器”的启动图标,鼠标右键--打开文件所在的位置,就会进入***\Nox\bin,默认路径是C:\Program Files (x ...

  3. PHP魔术方法和魔法变量详解

    一.魔术常量 __LINE__ 文件中的当前行号.__FILE__ 文件的完整路径和文件名.如果用在被包含文件中,则返回被包含的文件名. 自 PHP 4.0.2 起,__FILE__ 总是包含一个绝对 ...

  4. mac 设置 MySQL 数据库默认编码(字符集)为 UTF-8

    mac 设置 MySQL 数据库默认编码(字符集)为 UTF-8   原文链接:https://juejin.im/post/5bbdca76e51d45021147de44 鉴于有些刚接触 MySQ ...

  5. Swift 条件语句

    条件语句通过设定的一个或多个条件来执行程序,在条件为真时执行指定的语句,在条件为 false 时执行另外指定的语句. 可以通过下图来简单了解条件语句的执行过程: Swift 提供了以下几种类型的条件语 ...

  6. 19.网络插件calico

    19.网络插件calico 官网: https://docs.projectcalico.org/v3.8/introduction/ calico默认工作在192.168.0.0/16 的网络 ca ...

  7. [Scikit-learn] 2.3 Clustering - kmeans

    参考: 2.3. Clustering 2.4. Biclustering 2.1.2.3. The Dirichlet Process Clusering, GMM, Variational Inf ...

  8. AppCode 2016.3 注册码

    43B4A73YYJ-eyJsaWNlbnNlSWQiOiI0M0I0QTczWVlKIiwibGljZW5zZWVOYW1lIjoibGFuIHl1IiwiYXNzaWduZWVOYW1lIjoiI ...

  9. Anaconda+tensorflow(不用创建虚拟环境)

    网上大部分教程都是:创建tensorflow虚拟环境(conda create -n tensorflow python=3.6),然后在虚拟环境中pip install tensorflow,但是每 ...

  10. Flutter酷炫的路由动画效果

    现在Flutter的路由效果已经非常不错了,能满足大部分App的需求,但是谁不希望自己的App更酷更炫那,下面介绍几个酷炫的路由动画. 其实路由动画的原理很简单,就是重写并继承PageRouterBu ...