将 ActiveDirectoryMembershipProvider 与两个域控制器结合使用

发布于 2024-07-05 03:50:43 字数 208 浏览 8 评论 0原文

我们有一个在客户站点上运行的 ASP.NET 应用程序,该应用程序使用 ActiveDirectory 通过 ActiveDirectoryMembershipProvider 进行用户登录。 我们指向的他们的主域控制器今天早上出现故障,在重新设置所有内容时,客户想知道我们是否可以与两个域控制器建立冗余连接; 即指定主AD服务器和备份AD服务器。 谷歌搜索没有结果 - 有谁知道这是否可以做到?

We have an ASP.NET application running at a customer site that uses ActiveDirectory for user login via the ActiveDirectoryMembershipProvider. Their primary domain controller that we were pointing to went down this morning, and in getting everything set back up the client was wondering if we could have a redundant connection to two domain controllers; i.e. specifying a primary and a backup AD server. A Google search proved fruitless - does anyone know if this can be done?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

东京女 2024-07-12 03:50:43

如果 ActiveDirectory 无法处理多个域控制器,那么它就不是一项非常好的技术。

您只需确保在成员资格配置中指向“域”而不是“服务器”,然后将两个或更多控制器添加到您的域。

一般来说,如果您将域引用为“LDAP://server/DC=domain,DC=com”,那么您应该能够删除“server”部分并简单地引用“LDAP://DC=domain,DC” =com"

以下代码项目给出了您可以通过 C# 在 Active Directory 中执行的操作的一长串: http://www.codeproject.com/KB/system/everythingInAD.aspx#7

If ActiveDirectory couldn't handle multiple domain controllers then it wouldn't be a very good technology.

You just need to make sure in your Membership configuration you are pointing to the 'Domain' rather than the 'Server' and then add two or more controllers to your domain.

Generally if you are referring to the domain as "LDAP://server/DC=domain,DC=com" then you should be able to remove the "server" part and refer simply to "LDAP://DC=domain,DC=com"

The following code project gives a long list of things you can do in Active Directory from C#: http://www.codeproject.com/KB/system/everythingInAD.aspx#7

小清晰的声音 2024-07-12 03:50:43

这是可以做到的,只是需要一些工作。

您将需要创建一个继承 ActiveDirectoryMemberhsipProvider 的类,并使用它来代替您的提供程序。 这样您就可以维护大部分功能。 然后设置一种方法来指定两个 connectionStringName 属性,一个用于主属性,一个用于辅助属性。 您还需要创建代码来从配置中读取信息,因为您正在更改配置。 然后,只需重写需要在主数据库关闭时捕获并切换到辅助数据库的方法即可。 这将是最可重用的方法。

可能还有其他方法可以做到这一点,但它可能会很笨拙并且不太可重用。 就像在每个请求之前测试连接然后以这种方式设置连接字符串一样。

基于该课程的 MSDN 文档 ,这可能是唯一的方法。 他们不提供内部功能。

It can be done, it will just take some work.

You will need to create a class that inherits off of the ActiveDirectoryMemberhsipProvider and use it has your provider instead. That way you can maintain most of the functionality. Then setup a way to specify two connectionStringName properties, one for primary and one for secondary. You will also need to create the code to read the information from the config since you are changing it. Then just override the methods where you need to catch when the primary is down and switch to the secondary. This will be the most reusable way of doing it.

There's probably other ways of doing it, but it will probably be hacky and not very reusable. Like testing the connection before each request and then setting the connectionstring that way.

Based on the MSDN documentation on the class, this will probably be the only way to do it. They don't provide the functionality internal.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文