是否可以在开发机器上模拟子域?
我正在尝试在我的网站上设置一个子域,但我很难让它工作。 特别是因为我测试它的唯一方法是将开发计算机所需的所有文件发送到托管服务器(有时会破坏网站)。 我在 IIS7 服务器上使用 asp.net 有
没有一种简单的方法可以在开发计算机上进行设置?
I am trying to set up a subdomain on my website but i am having a hard time getting it to work. Especially since the only way i can test it is by sending all the files needed from my development machine to the hosting server (and sometimes breaking the website). i am using asp.net on an IIS7 servers
Is there an easy way to do the setting on the development machine?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以做的一件事是编辑“\system32\drivers\etc\hosts”文件,并将域名指向 127.0.0.1。
通过在文件底部添加一行来完成此操作:
问题是关于 ASP.NET 和 IIS,所以我假设是 Windows,但以防万一有人读到此内容想要了解 Linux 等效项,您需要编辑文件“/etc/hosts”,并添加一行相同格式的内容。
非常重要的注意事项:如果您像这样将真实域名重定向到本地计算机,请不要忘记您这样做了,否则当您无法弄清楚原因时,您会发疯的您上传到实时网站的更改没有任何作用。 不是我从经验或其他什么中知道的。
One thing you can do is to edit your "<windows directory>\system32\drivers\etc\hosts" file, and point the domain name to 127.0.0.1.
Do this by adding a line at the bottom of the file:
The question was about ASP.NET and IIS, so I assumed Windows, but just in case anybody reads this that wants to know the Linux equivalent, you'll want to edit the file "/etc/hosts", and add a line of the same format.
Very important note: If you redirect the real domain name to your local machine like this, don't forget that you did it, or it'll drive you nuts later when you can't figure out why the changes you uploaded to the live site aren't doing anything. Not that I know from experience or anything.
你说的模拟是什么意思? 您可以轻松地在主机文件
\system32\drivers\etc\hosts
中添加子域
只需确保您有这个新域的 DNS 条目即可。 因此,请联系负责创建它们的人。
希望这可以帮助。
what did you mean by simulate? You can easily add a subdomain in your host file
\system32\drivers\etc\hosts
Just make sure that you have a dns entry for this new domain. So contact whoever is incharge of creating them.
Hope this helps.