IIS 服务器是否必须位于域中才能进行 Windows 身份验证和角色?

IIS 服务器是否必须位于域中才能进行 Windows 身份验证和角色?

我有一个使用 Windows 身份验证的 asp.net 应用程序。

我在我的 XP 机器上安装了 IIS 服务器 5.1,并且它在 Win 授权下运行良好;但是,我无法使用“角色”,因为由于某种原因,它不能与活动目录同步,而且我不知道如何让它同步。

您知道我需要什么样的配置/设置才能使 IIS 与 AD 同步吗?当我进入网站管理工具并查看角色中的角色和用户时,没有显示任何用户。我确实在 AD 中创建了安全组并向其中添加了用户,但我在网站管理工具中看不到它们。

非常感谢您的指导。

我目前收到此错误:

Compilation Error Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. Compiler Error Message: CS1061: 'ASP.default_aspx' does not contain a definition for 'SqlDataSource1_Selecting' and no extension method 'SqlDataSource1_Selecting' accepting a first argument of type 'ASP.default_aspx' could be found (are you missing a using directive or an assembly reference?) Source Error: Line 143: </ItemTemplate> Line 144: – I__ 12 mins ago 
</asp:FormView> Line 145: <asp:SqlDataSource ID="SqlDataSource1" runat="server" Line 146: ConnectionString="<%$ ConnectionStrings:qcvalues_testConnectionString %>" Line 147: SelectCommand="SELECT * FROM [batchinfo]" Source File: c:\Documents and Settings\agordon\My Documents\Visual Studio 2008\Projects\EnterData\EnterData\Default.aspx Line: 145 – I__

我确实听从了乔尔的建议并这样做了:

<roleManager enabled="true"
             defaultProvider="AspNetWindowsTokenRoleProvider"/>

答案1

如果您已使 Windows 身份验证正常工作,则与活动目录的连接工作正常。您可能缺少的配置点是属于 web.config 的角色提供程序:

<roleManager enabled="true"
             defaultProvider="AspNetWindowsTokenRoleProvider"/>

通过调用以下方法,您还可以通过角色立即访问用户所属的组:

User.IsInRole
Roles.IsUserInRole

这是 MSDN 文章,讨论了将 Windows 身份验证“开箱即用”地纳入 asp.net 站点。

http://msdn.microsoft.com/en-us/library/ff647405.aspx

相关内容