本地IIS无法连接本地数据库 [英] Local IIS unable to connect local database

查看:253
本文介绍了本地IIS无法连接本地数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用来自(localdb)\V11.0服务器的数据库,并且在使用VS2013中的IIS Express时能够成功连接,但是在LocalIIS中部署时,它在下面给了我一个错误-

I am using a db from (localdb)\V11.0 server and able to connect successfully when using IIS express from VS2013, but when deployed in LocalIIS, it gives me an error below -



建立与SQL Server的连接时发生了与网络相关或特定于实例的错误。找不到服务器或
无法访问。

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible.

为了修复我已经更新了 applicationHost.config 文件,如下所示

In order to fix that I have updated applicationHost.config file as below

<add name="DefaultAppPool">
    <processModel identityType="ApplicationPoolIdentity" loadUserProfile="true" setProfileEnvironment="true" />
 </add>

现在,尽管数据库未连接,但它显示了一个主页,但是所有数据驱动的下拉列表值是空的。我还尝试将应用程序池更改为 LocalSystem ,但是网站无法连接数据库。有没有需要调查的特定领域?

Now, though database is not connected, it has displayed a home page, but all data-driven dropdown values are empty. I have also tried changing Application pool to LocalSystem but website unable connect db. Is there any specific area that I need to investigate?

推荐答案

要使本地db在我的计算机上运行IIS,请按照此msdn博客

To get local db running with IIS on my machine, I followed the guidance in this msdn blog

最适合我的解决方案是将IIS应用程序池配置为以Windows用户身份运行。

The solution that worked best for me was to configure IIS application pools to run as my windows user.

这是通过IIS界面完成的。在应用程序池部分中,右键单击一个(或多个)并选择高级设置。选择身份和自定义,然后输入您的用户名和密码。

This is done via the IIS interface. In the "Application Pools" section, right click on one (or more) and choose "Advanced Settings". Choose "Identity" and "Custom" then enter your username and password.

这篇关于本地IIS无法连接本地数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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