网站托管在IIS中时无法打开数据库 [英] Unable to open database when website hosted in IIS

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

问题描述

当我从Visual Studio运行网站时,一切正常.现在,我试图继续前进并开始测试多租户部分,因此我不得不将网站移至IIS.

When I run my website from Visual Studio it all works fine. Now I am trying to move forward and start testing the multi tenancy part, so I had to move my website to IIS.

由于某种原因,我无法访问数据库.打开需要数据库访问权限的页面时出现的错误是:

For some reason I can't get access to the database. The error I get when I open a page that requires database access is:

无法打开登录请求的数据库"GWD".登录失败.用户'IIS APPPOOL \ gwd'登录失败.

异常详细信息:System.Data.SqlClient.SqlException:无法打开登录名请求的数据库"GWD".登录失败.登录失败用户"IIS APPPOOL \ gwd".

另一个论坛描述了如何添加 NT AUTHORITY \ NETWORK SERVICE .但这不能解决问题.我确实创建了 NT AUTHORITY \ NETWORK SERVICE ,并为所有现有数据库(包括master)添加了dbowner,但没有结果.

Another forum describes how to add NT AUTHORITY\NETWORK SERVICE. But that doesn't resolve the issue. I did create the NT AUTHORITY\NETWORK SERVICE and added the dbowner for all existing databases (including master) but no result.

我没主意了,有人可以帮忙吗?

I am out of ideas, can anybody help?

推荐答案

您还需要将应用程序池标识更改为 NETWORK SERVICE .启动Internet信息服务(IIS)管理器,深入到应用程序池",然后选择您正在使用的应用程序池.(不确定吗?在左侧的站点"下向下钻取到虚拟目录,然后在右侧单击基本设置".)然后单击应用程序池",单击高级设置",然后将进程模型"下的身份"更改为NetworkService.

You'll need to change the application pool identity to NETWORK SERVICE as well. Fire up Internet Information Services (IIS) Manager, drill down to Application Pools, and select the Application Pool that you're using. (Not sure? Drill down to your virtual directory under Sites on the left side and then click Basic Settings on the right.) Then click your Application Pool, click Advanced Settings, and then change Identity under Process Model to NetworkService.

在SQL Server Management Studio中,您需要为数据库添加 NT AUTHORITY \ NETWORK SERVICE 用户,但听起来您已经这样做了.

In SQL Server Management Studio, you'll need to add the NT AUTHORITY\NETWORK SERVICE user under Security for your database, but it sounds like you already did that.

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

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