以编程方式创建 DNS 记录

发布于 2024-07-08 12:38:50 字数 318 浏览 3 评论 0原文

情况是,我有一个网站,用户获得一个子域。 例如:client.mydomain.com。 如果客户未能满足某些条件(例如付款违约),我希望上述网站指向不同的网站。 我们想要做到这一点的方法是创建具有适当重定向的 DNS 记录。

我使用win 2003服务器,并在.Net中编程。 关于如何以编程方式执行此操作的任何输入?

我确实控制该网站,但原因是有很多用户(因此有子域),并且(client.mydomain.come)没有物理网站,它就像用户拥有博客的 wordpress/blogger。 wordpress.com(我认为他们不会为每个用户创建一个新网站)。

The situation is, I have a website where the users get a sub domain. eg: client.mydomain.com. If the client fails to meet certain condition (eg. payment default), I want the above site to be pointing to a different web site. The way we want to do it is by creating a dns record with the appropriate redirection.

I use a win 2003 server, and program in .Net. any inputs on how I can programmatically do this?

I do control the website, however the reason is there are a lot of users (and hence sub domains) and also there is no physical website for (client.mydomain.come), it's like a wordpress/blogger where a user has blog.wordpress.com (and I assume they don't create a new website for each user).

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

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

发布评论

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

评论(4

月野兔 2024-07-15 12:38:50

是否应该可以将 *.domain.com 映射到您的服务器 IP,然后从您的应用程序配置主机绑定? 这样您将为所有用户使用相同的应用程序。 否则,您始终可以自己检查主机并重定向、切换 webroot 等或任何您想要的。

Shouldn't it be possible to map *.domain.com to your server-ip and then from your app configure the host-binding? that way you will use the same app for all users. Otherwise, you can always check the host yourself and redirect, switch webroot etc or whatever you want.

熟人话多 2024-07-15 12:38:50

那么,使用 .Net 和 Windows 2003 服务器,您可以使用 WMI 脚本来完成此操作。
您可以在此处找到有关 DNS WMI 类的更多信息

但是

我强烈建议您不要使用 Windows 服务器作为公共 DNS 服务器 - 出于安全和性能原因,您最好使用运行 BIND 的 Linux 服务器。 此外,使用 BIND-dlz(BIND 的附加组件),您可以使 BIND 使用几乎任何 SQL 数据库作为 DNS 记录的数据源。 从 BIND 9.4 开始,BIND-dlz 包含在核心 BIND 发行版中。 更多信息请访问 http://bind-dlz.sourceforge.net

Well, using .Net and a windows 2003 server, you can do this using WMI scripting.
You can find more information on the DNS WMI classes here

HOWEVER

I strongly recommend that you do not use a Windows server for a public DNS server - for security and performance reasons you are much better off using a linux server running BIND. In addition, using BIND-dlz (a add on for BIND), you can make BIND use almost any SQL database as a datasource for your DNS records. As of BIND 9.4, BIND-dlz is included in the core BIND distribution. More information can be found at http://bind-dlz.sourceforge.net

蔚蓝源自深海 2024-07-15 12:38:50

如果您控制该网站,我认为最好是设置重定向而不是更改 DNS 记录。 重定向可以很简单,只需将当前文档索引(例如,index.htm)重命名为您自己的文档索引即可对目标进行元重定向。

DNS 更改的传播速度很慢,因此即使 TTL 较小,禁用和启用也会出现延迟。 另一个改变更容易、更直接。

If you control the website, I think that best would be to setup redirections instead of changing DNS records. The redirection could be as simple as renaming the current document index (say, index.htm) for one of your own that'll do a meta redirect to the destination.

DNS changes are slow to propagate, so there will be delays in the disabling and also in the enabling, even with small TTL. The other change is easier and immediate.

风吹过旳痕迹 2024-07-15 12:38:50

使用 Amazon AWS Route 53 等服务作为您的 DNS,然后您可以以编程方式使用他们的 API 来添加/删除/更改 DNS 记录。

Use a service like Amazon AWS Route 53 for your DNS, then you can programmatically use their API to add/remove/alter DNS records.

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