场景: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. fluent中隐藏模型的开启【转载】

    转载自:http://blog.sina.com.cn/s/blog_5fd791530100d5ic.html fluent中设置了一些隐藏模型,普通的用户界面是没有相关选项的,必须用相关命令开启. ...

  2. legend3---13、vue是真的好用

    legend3---13.vue是真的好用 一.总结 一句话总结: 下次前端所有的交互页面都可以用vue 1.chrome查看post请求携带的参数? 请求的Headers里面的Form Data里面 ...

  3. Qt自定义委托在QTableView中绘制控件、图片、文字

    自定义委托,继承于,QStyledItemDelegate类,重载Paint()函数, 1.实现在QTableView中绘制 格式字符串 2.实现在QTableView中绘制进度条 3.实现在QTab ...

  4. php操作成功返回当前页并刷新

    echo "<script>alert('操作成功');location.href='".$_SERVER["HTTP_REFERER"].&quo ...

  5. Python之操作RabbitMQ

    RabbitMQ是一个在AMQP基础上完整的,可复用的企业消息系统.他遵循Mozilla Public License开源协议. MQ全称为Message Queue, 消息队列(MQ)是一种应用程序 ...

  6. 用SSMS连接Azure Sql Database 与连接本地库的一些操作区别

    背景 我们知道Azure Sql Database 可以降低运维成本.是一种Pass模式,有资源弹性设置,可以自由调整资源自动对应不同业务高峰(当然也可以降低费用成本),也方便项目后期的资源扩展,以及 ...

  7. maven编译正常,运行报错:中没有主清单属性

    在pom.xml添加插件 <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId&g ...

  8. ubuntu下virtualbox的安装、卸载

    一.添加VirtualBox的源并安装5.1版本 virtualbox官网:https://www.virtualbox.org/wiki/Download_Old_Builds 虽然也可以直接安装d ...

  9. windows进入指定目录

    1.进入cmd 2.输入盘符比如:E: 3.切换目录 cd E:\progect\Firstdjango 实例:

  10. mysql自身报错、java、reids连接mysql数据库报错汇总

    1.Can't connect to local MySQL server through socket 'tmpmysql.sock' (2) 原因是mysql根本没有启动 2.Access den ...