给ASPNETDB.MDF SQL数据库的权限IIS_IUSRS [英] Give ASPNETDB.MDF SQL DB IIS_IUSRS Permissions

查看:653
本文介绍了给ASPNETDB.MDF SQL数据库的权限IIS_IUSRS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

拥有对这种情况已经越来越pretty光头!

Have been getting pretty bald over this situation!

我使用的MS VS 2010的C#ASP.NET和MS SQL EX $ P $干燥综合征2008,IIS 7的Windows 7。

I am using MS VS 2010 C# ASP.NET, and MS SQL EXPRESS 2008, IIS 7 on Windows 7.

我有一个页面上的asp.net登录控制。它的工作原理很完美的开发环境。

I have the asp.net login control on a page. It works quite flawlessly in development environment.

当我移动网站IIS,则显示登录aspx页面和一切似乎是工作的罚款。当我把我的登录凭据(已在MS VS开发服务器在同一数据库上进行测试),然后点击登录,我与美国我没有权限的IIS错误psented $ P $。 (请参阅堆栈跟踪)

When I move the site to IIS, the login aspx page is displayed and all seems to be working fine. As soon as I put in my login credentials (which have been tested on the same database in MS VS Dev server) and click login, I am presented with an IIS error that states I do not have permission. (Please see stack trace)

我已经做了一些挖掘,读,当MSVS的创建登录控制数据库,它给的权限当前用户。因此后,当我们移动这对我们的生产服务器(它不是一个真正的服务器,它只是IIS我们的Win 7的机器来测试之一),并尝试通过互联网登录,它好像IIS_IUSRS没有权限。

I have done some digging, and read that when MSVS creates the database for the login control, it gives permissions to the current user. Therefore, when we move this to our production server (its not really a server, its just IIS on one of our win 7 machines to test) and try to login via the internet, it seems as if IIS_IUSRS does not have permissions.

事情我都试过

1:从溶液中分离数据库,在SQL服务器管理器安装它,并试图设置权限那里。难道不能识别IIS_IUSRS帐户。 (我试过计算机名/ IIS_IUSRS太)。这可能是有道理的,因为IIS_IUSRS是不是一个真正的Windows帐户。我也有同样的问题,试图给权限NT AUTHORITY。

1: Detaching the database from the solution, attaching it in SQL Server Manager, and trying to set the permissions there. Couldn't recognize IIS_IUSRS account at all. (I tried computer name / IIS_IUSRS too). This probably makes sense since IIS_IUSRS is not really a windows account. I also had the same issues trying to give permissions for NT AUTHORITY.


  1. 我在想,如果我能以某种方式创建IIS_IUSRS数据库会自动计算出管道的我,但不知道在这里启动,或者如果多数民众赞成可能。

这是我使用连接到我的数据库连接字符串:

This is my connection string that I am using to connect to the db:

  <connectionStrings>
    <remove name="ApplicationServices"/>
    <add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated Security=True;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient" />
  </connectionStrings>

任何帮助是极大AP preciated,我一直在坚持,现在相当一段时间。

Any help is greatly appreciated, I have been stuck for quite some time now.

推荐答案

这可能有点特殊,但也有确为他人在这种混合一些解决方案。以下是我不得不从开发环境做端口我的asp.net网站(MS VS 2010,SQLEX preSS)到IIS 7。

This may be a little specific, but there are most surely some solutions for others in this mix. Here is what I had to do to port my asp.net website from a Development environment (MS VS 2010, SQLEXPRESS) to IIS 7.

这是什么会解释,是如何设置两个Web应用程序在一个网站(WEBSITE1和网站2)。 WEBSITE1将使用ASPNETDB.MDF(Visual Studio创建),并WEBSITE2将使用WEBSITE2这是手动MS SQL Server 2008中我们将移植ASPNETDB.MDF到SQL Server 2008以及便于操作的创建的数据库。

What this will explain, is how to set up two web application under one website (Website1, and Website2). Website1 will use aspnetdb.mdf (created by visual studio) and Website2 will use website2 database which was manually created in MS SQL Server 2008. We will be porting the aspnetdb.mdf to sql server 2008 as well for ease of manipulation.

WEBSITE1也将有权在网站2创建的文件和目录。

Website1 will also have permissions to create files and directories on website2.

第1 IIS设置

* 第1步:的*
wwwroot中创建一个新的文件夹来保存这两个应用程序(我们称之为网站)
复制粘贴网站文件夹WEBSITE2和WEBSITE1。

*Step 1:* create a new folder in wwwroot to hold both applications (We called it websites) Copy paste "WebSites" folders for website2 and website1.

第二步:
*的应用程序池WEBSITE1 的*
如果尚未创建,创建应用程序池配置为使用.NET框架4.0,集成管道模式,我们把它叫做asp4。

Step 2: *App pool for website1* If not already created, create the Application pool and configure it to use .NET framework 4.0, Integrated pipeline mode, we called it asp4.

应用程序池的网站2
目前使用的应用程序池WEBSITE1

App pool for website2 Currently uses App pool for website1

第3步:

添加WEBSITE1
在IIS管理器,添加新的网站。指向它的物理目录,我们只是复制到根(第1,步骤1)新文件夹WEBSITE1。
选择WEBSITE1应用程序池,的见第1,第2步的。
我们设置站点名称相同的物理目录(网站1)。

Add website1 In IIS MANAGER, add new website. Point its physical directory to website1 that we just copied into the new folder on the root (Section 1, Step 1). Select the application pool for website1, See Section 1, step 2. We set the site name the same as the physical directory (website1).

验证等要求,第2节WEBSITE1 DB设置和IIS文件夹权限。

Verify other requirements, Section 2 website1 DB Setup and IIS folder permissions.

添加网站2
在IIS管理器,右击刚刚创建的新网站的应用程序,选择添加虚拟目录。结果
设置为我们复制到我们的新文件夹的wwwroot的抱着两个应用程序的文件夹WEBSITE2的物理路径,见第1,第1步的。
转换为应用程序,并选择WEBSITE1的应用程序池,的见第1,第2步的。
我们设定的别名一样的物理路径的文件夹,WEBSITE1。

Add website2 In IIS Manager, right click the new website application we just created, select "Add Virtual Directory".
Set the physical path to the website2 folder that we copied to our new folder on the wwwroot holding both applications, See Section 1, step 1. Convert to application and select the application pool for website1, See Section 1, step 2. We set the alias to the same as the physical path folder, website1.

目前,没有连接要求通过。
验证其他要求的第3部分 - WEBSITE2数据库设置为网站2

Currently, there are no connection requirements to pass through. Verify other requirements Section 3 - website2 Database setup for website2

第2节WEBSITE1 DB设置和IIS文件夹权限

第1步ASPNETDB.MDF调整:
注意:从现在开始,将可能只使用最新的aspnetdb.bak文件

Step 1 aspnetdb.mdf adjustments: Note: From now on will probably just use most recent aspnetdb.bak file.

由rightclicking数据库的连接和DB ASPNETDB.MDF连接到MS SQL服务器。

Attach aspnetdb.mdf into ms sql server by rightclicking database's and attaching DB.

第2步 - IIS用户登录
如果没有设置用户 - 的第4节,第1步为IIS用户创建一个DB登录

如果没有权限设置 - 第4,第2步设置权限在IIS用户分贝

if permissions not setup - Section 4, Step 2 Setting Permissions for the IIS USER on the db

code调整/考证
需要删除用户实例变量。(;用户实例=真)在web.config中通过MS VS在连接字符串自动生成

Code Adjustments / Verifications need to remove user instance variable (;User Instance=true) auto generated in connection string by MS VS in web.config.

-    <remove name="ApplicationServices"/>
-          Not 100% neccessary but this will make it more scalable accross platforms
-       In the web.config, make sure we are using the database we attached /        restored on MS SQL Server.
    -     "data source=.\SQLEXPRESS;Integrated Security=SSPI;initial catalog=aspnetdb" (because we renamed it aspnetdb)

第3部分 - WEBSITE2数据库设置为网站2

确认DB将恢复到MS SQL SERVER
数据库要求

Make sure DB is restored on MS SQL SERVER Database requirements

第1步

如果没有设置用户 - 的第4节,第1步为IIS用户创建一个DB登录

If user is not set up - Section 4, Step 1 Create a DB Logon for the IIS USer

第2步

如果没有权限设置 - 第4,第2步设置权限在IIS用户分贝

if permissions not setup - Section 4, Step 2 Setting Permissions for the IIS USER on the db

第3步文件夹权限(后子站点WEBSITE2添加)

设置文件夹的权限:由于WEBSITE1写入文件,并在网站2创建的文件夹,(它的设置要一直在寻找在WEBSITE2文件夹中的父文件夹),我们需要给服务器IIS_IUSRS,我们是(IIS_IUSRS(MIKE71 \\ IIS_IUSRS)权限

Set folder permissions : Since website1 writes files and creates folders in website2, (its set up to be always looking in the parent folder for website2 folder) we need to give server IIS_IUSRS , ours is (IIS_IUSRS(MIKE71\IIS_IUSRS) permissions.

从IIS中,单击鼠标右键嵌套应用WEBSITE2并选择编辑权限。确保修改和写入priveledges检查关闭IIS_IUSRS。

From within IIS, rightclick the nested application website2 and select edit permissions. Ensure that modify and write priveledges are checked off for IIS_IUSRS.

第4节 - 添加IIS用户DATABSE并给予权限

步骤0附加和恢复数据库


  • 如果数据库尚未连接到MS SQL Server中,我们需要重视的.mdf文件。

  • 我们可以通过rightclicking数据库,恢复到我们的数据库连接恢复数据库,并从提供的.bak文件恢复。

  • 如果有麻烦,因为数据库定义的恢复(从头开始创建一个干净的)尝试:
    RESTORE DATABASE trimweb
    FROM DISK ='C:\\ trimweb.bak
    WITH REPLACE

第1步为IIS用户创建数据库登录

为什么呢?需要创建并允许IIS APPOOL \\ asp4用户有权限DATABSE,设置为数据读取(在一节中创建的应用程序池,步骤2)

Why? Need create and allow IIS APPOOL\asp4 user to have permissions to databse, set as data reader (the application pool created in Section one, Step 2)

如何:在MS SQL Server的安全部分,需要右键点击用户,并添加IIS APPPOOL \\ asp4(IIS APPPOOL \\ apppoolname,在一节创建的,步骤2)。
<一href=\"http://stackoverflow.com/questions/1933134/add-iis-7-apppool-identities-as-sql-server-logons\">Add IIS 7的应用程序池标识与SQL Server登录

How: In the security section in MS SQL SERVER, need to right click users and add IIS APPPOOL\asp4 (IIS APPPOOL\apppoolname, created in Section one, Step 2). Add IIS 7 AppPool Identities as SQL Server Logons

第2步设置权限在IIS用户分贝

右键单击数据库名称,(网站2分贝),然后单击属性。在权限部分添加您刚刚在第4节,第1步创建了APPPOOL的用户,一定要给他执行和选择权限。

Right click on the database name, (website2 db) and click properties. In permissions section add your APPPOOL user that you just created in Section 4, Step 1, be sure to give him Execute and Select permissions.

注:的WEBSITE1需要执行,选择,删除,插入权限也是如此。 WEBSITE2也使用这个应用程序池,它不应该是因为我们不不需要alow用户有这样的功能,从trimdynamics应用程序中。我们可以单独的应用程序池,使我们的修剪力度IIS的USR只得到执行和选择的权限。

Note: Website1 needs Execute, Select, Delete, Insert permissions as well. Website2 is also using this app pool which it shouldnt be because we dont not need to alow the user to have that kind of functionality from within the trimdynamics application. We could seperate the app pools so that our trim dynamics IIS USRS is only getting Execute and Select permissions.

这篇关于给ASPNETDB.MDF SQL数据库的权限IIS_IUSRS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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