IIS托管的网站无法访问数据库 [英] IIS hosted website cannot access database

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

问题描述

你好,

我有一个使用本地数据库的MVC3应用程序.我在web.config文件中有一个连接字符串,用于指定连接.

Hi there,

I have a MVC3 application which uses a local database. I have a connection string in web.config file which specifies the connection.

<add name="RoomDB" 
       connectionString="Data Source=.\SQLEXPRESS;Integrated Security=SSPI;Initial Catalog=Room Details;User ID=sa;Password=sa;" 
       providerName="System.Data.SqlClient" />


我的应用程序运行正常,但是当我使用默认应用程序池将应用程序托管在本地系统的IIS7中时,该应用程序无法打开数据库访问页面,并显示以下错误.
登录名无法打开数据库房间详细信息".登录失败.
用户"IIS APPPOOL \ DefaultAppPool"的登录失败.
我认为连接字符串或应用程序池有问题.
请在这方面为我提供帮助.

预先感谢,
Naresh S.


My application works fine but when I hosted the application in IIS7 in my local system using default app pool, the application can''t open the database accessing pages showing the below error.
"Cannot open database "Room Details" requested by the login. The login failed.
Login failed for user ''IIS APPPOOL\DefaultAppPool''."

I think something wrong with connection string or in Application pool.
Please provide me help in this regard.

Thanks in advance,
Naresh S.

推荐答案

推荐的Microsoft解决方案是创建一个单独的帐户.但是,如果您的解决方案很小,则可以在SQL实例中将"IIS APPPOOL \ DefaultAppPool"用户添加为数据库用户,然后向需要DefaultAppPool用户的数据库提供适当的用户映射"使用权.

您不一定可以搜索该用户,但仍可以在登录-新建"窗口的登录名"字段中将其输入为"IIS APPPOOL \ DefaultAppPool"(不带引号).

MSDN参考,网址为: http://social.msdn .microsoft.com/Forums/zh-CN/sqlsetupandupgrade/thread/73eee0b4-9eee-4a71-a448-3e3eef9ee404/ [
The recommended Microsoft solution is to create a separate account. However, if your solution is small, you can instead add the ''IIS APPPOOL\DefaultAppPool'' user as a database user in your SQL instance, then providing the proper ''User Mappings'' to the databases you need the DefaultAppPool user to access.

You may not necessarily be able to search for this user, but you can still enter it in the ''Login name'' field in the "Login - New" window as "IIS APPPOOL\DefaultAppPool" (without the quotes).

MSDN Reference at: http://social.msdn.microsoft.com/Forums/en-US/sqlsetupandupgrade/thread/73eee0b4-9eee-4a71-a448-3e3eef9ee404/[^]


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

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