本文介绍了IIS7,SQL 2008和ASP.NET MVC的安全性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有我工作的一个ASP.NET MVC应用程序。我一直在开发它的Windows Server 2003 IIS6和SQL 2008前preSS上,一切是伟大的工作。我最近决定尝试在Windows 7测试版,所以现在我使用IIS7,并与连接到我的数据库,我似乎无法找出碰到一个问题。

I have an ASP.NET MVC application that I'm working on. I've been developing it on Windows Server 2003 with IIS6 and SQL 2008 Express, and everything was working great. I recently decided to try out the Windows 7 beta, so now I'm using IIS7, and have run into a problem with connectivity to my database that I can't seem to figure out.

我可以运行/调试应用得很好,但每当我尝试访问需要访问数据库的页面时,我得到以下错误:

I can run/debug the app just fine, but whenever I try to access a page that needs to access the database, I get the following error:

无法打开数据库MyDatabaseName由登录请求。登录失败。
用户登录失败'IIS APPPOOL \\ MyApplicationName'。

"Cannot open database "MyDatabaseName" requested by the login. The login failed.Login failed for user 'IIS APPPOOL\MyApplicationName'."

我显然得到了一些安全配置设置不正确,但我似乎无法找到任何良好的文档的如何的正确设置。我试过在数据库上为网络服务权限,但似乎并没有工作。有谁知道我需要做给IIS APPPOOL \\ MyApplicationName权限到这个数据库?我失去了一些东西明显?

I've obviously got some security configuration setup incorrectly, but I can't seem to find any good documentation on how to set it up correctly. I've tried giving NETWORK SERVICE permissions on the database, but that didn't seem to work. Anyone know what I need to do to give "IIS APPPOOL\MyApplicationName" permissions to this database? Am I missing something obvious?

谢谢...

推荐答案

如果你不使用的ActiveDirectory,然后无视上述所有其他解决方案。这种混乱在IIS 7.5中新的ApplicationPoolIdentity设置默认值(MS不断变化的身份mechianisms)

If you are NOT using ActiveDirectory, then ignore all of the other solutions above. The confusion stems from the new ApplicationPoolIdentity setting default in IIS 7.5 (MS keeps changing the identity mechianisms)


  1. 开启 SQL Management Studio中后,连接到本地计算机的管理员。

  2. 展开安全分支。

  3. 右键单击登录并选择新建登录

  4. 登录名字段中,键入 IIS APPPOOL \\ MyApplicationName 。做的的点击搜索按钮。用户配置文件不到风度实际上是在本地计算机上存在的,它是根据需要动态创建的。

  1. Open SQL Management Studio, connect to your local machine as an admin.
  2. Expand the Security branch.
  3. Right click on Logins and select New Login
  4. Into the Login Name field, type "IIS APPPOOL\MyApplicationName". Do NOT click the search button. The user profile dosn't actually exist on the local machine, it's dynamically created on demand.

这篇关于IIS7,SQL 2008和ASP.NET MVC的安全性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-01 16:31