转自codeproject,找了半天解决办法,这个最靠谱。

我数据库用的EF做ORM,在vs里面测试的时候不会出现这个错误,用IIS就出错了。解决方法如下

Solution for "The underlying provider failed on Open" exception.

By venugopalm, 11 Nov 2010
 
 
As you guys know that I am posting enterprise architecture design article in code project here. While preparing third part, I started to implement simple tier application for demo. After completing server side implementation, I started to implement simple client for demo purpose. Once completed with client, i tried to run my demo application. But unfortunately I got the strange exception called "The underlying provider failed on Open". I googled more than an hour and found that most of the folks facing the same issue when they try to call the service which contains database access in local sql server through IIS. But no one is providing proper solution for this issue. Everyone says that IIS uses network credentials when it contacts sql server authentication process. So we should grant access to "NT AUTHORITY\NETWORK SERVICE" to your database.
But this is not the right solution and no one is saying how to fix the issue. After spending some hours, found the solution and my app running without any issues.

Here is the solution.

As folks mentioned IIS user network service user credentials while trying to log in sql server. So just change the Application pool settings in your IIS.
 
Step 1:
Open Internet Information Service Manager
Step 2:
Click on Application Pools in left navigation tree.
Step 3:
Select your version Pool. In my case, I am using ASP .Net v4.0. If you dont have this version, select DefaultAppPool.
Step 4:
Right click on step 3, and select advanced settings.
Step 5:
Select Identity in properties window and click the button to change the value.
Step 6:
Select Local System in Built-in accounts combo box and click ok.
That's it. Now run your application. Everything works well.
 
Enjoy!!!.

http://www.codeproject.com/Tips/126919/Solution-for-The-underlying-provider-failed-on-Ope?msg=4226646#xx4226646xx

如何解决The underlying provider failed on Open问题的更多相关文章

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

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

  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. System.Data.EntityException: The underlying provider failed on Open.

    场景:IIS默认站点建立程序,使用Windows集成身份验证方式,连接SQLServer数据库也是采用集成身份验证.我报“System.Data.EntityException: The underl ...

  4. The underlying provider failed on Open. EF

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

  5. 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 ...

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

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

  7. (转) 解决ssh的"Write failed: Broken pipe"问题

    解决ssh的"Write failed: Broken pipe"问题   问题场景 服务器环境:阿里云 Linux CentOS 主机 客户端:Mac OSX Terminal ...

  8. 如何解决WebkitBrowser使用出错“Failed to initialize activation context”

    本文转载自:http://www.cnblogs.com/supjia/p/4695671.html 本篇文章主要介绍了"如何解决WebkitBrowser使用出错“Failed to in ...

  9. 解决 EDAS:Upload failed: The right margin is 0.535 in on page 1 问题

    参考: IEEETran page margins 解决 EDAS:Upload failed: The right margin is 0.535 in on page 1 问题 在 EDAS 上上 ...

随机推荐

  1. c++刷题(3/100)数独,栈和队列

    stack的基本操作 • s.size():返回栈中的元素数量 • s.empty():判断栈是否为空,返回true或false • s.push(元素):返回对栈顶部“元素”的可变(可修改)引用 • ...

  2. Redis数据类型之字符串(string)

    1. string类型简介 string类型是二进制安全的,能够存储任意类型的字符串. string类型是最常用到的数据类型,一种常用的用法就是将对象格式化为JSON字符串然后放到redis中,取出来 ...

  3. 常用的css3新特性总结

    1:CSS3阴影 box-shadow的使用和技巧总结: 基本语法是{box-shadow:[inset] x-offset y-offset blur-radius spread-radiuscol ...

  4. 设计模式之Composite

    设计模式总共有23种模式这仅仅是为了一个目的:解耦+解耦+解耦...(高内聚低耦合满足开闭原则) Composite定义? 将对象以树形结构组织起来,以达成“部分-整体” 的层次结构. 想到Compo ...

  5. C++之模板编程

    当我们越来越多的使用C++的特性, 将越来越多的问题和事物抽象成对象时, 我们不难发现:很多对象都具有共性. 比如 数值可以增加.减少:字符串也可以增加减少. 它们的动作是相似的, 只是对象的类型不同 ...

  6. 如何在LINUX中开机、登陆、退出、定时、定期自动运行程序

    1.开机启动时自动运行程序 Linux加载后, 它将初始化硬件和设备驱动, 然后运行第一个进程init.init根据配置文件继续引导过程,启动其它进程.通常情况下,修改放置在 /etc/rc或 /et ...

  7. CentOS 7.1使用yum安装MySql5.6.24

    http://www.cnblogs.com/yuanfeiblog/p/5276492.html

  8. JS函数学习

    =============数学函数========== 1.Math.random()为取随机数0~1之间的:0可以取到,1取不到 alert(Math.random()); 2.Math.PI为3. ...

  9. js复制文字

    一.原理分析 浏览器提供了 copy 命令 ,可以复制选中的内容 document.execCommand("copy") 如果是输入框,可以通过 select() 方法,选中输入 ...

  10. PyCharm中 ImportError: No module named tensorflow

    安装完 tensorflow 后在 PyCharm 中导入时显示找不到,可设置如下: PyCharm 中依次打开 File -> Settings -> Project:PycharmPr ...