如何访问通配符子域在本地主机(.NET MVC 4)? [英] How do I access wildcard subdomains in localhost (.NET MVC 4)?

查看:169
本文介绍了如何访问通配符子域在本地主机(.NET MVC 4)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为寻找谢谢!

我开发的.NET 4.5框架(C#)的Web应用程序,需要允许用户创建一个帐户,然后与他们的帐户名称的子域(例如foobar.myDomain.com)。

I am developing a web app on the .NET 4.5 framework (C#) that needs to allow users to create an account and then have a subdomain with their account name (e.g. "foobar.myDomain.com").

我知道这需要涉及通配符子域在IIS - 有没有问题。我跟着<一个href="http://stackoverflow.com/questions/278668/is-it-possible-to-make-an-asp-net-mvc-route-based-on-a-subdomain">this SO帖子设立一个自定义路由拦截的URL请求,并解析出的子域。这的似乎的喜欢它的工作太棒了。

I realize that this needs to involve wildcard subdomains in IIS--no problems there. And I followed this SO post for setting up a custom route to intercept the URL requests and parse out the subdomain. That seems like it will work great.

到底如何做我测试的本地主机通配符子域?当我打类似foo.localhost我只是得到一个404。

How the heck do I test wildcard subdomains in localhost?? When I hit something like "foo.localhost" I just get a 404.

任何帮助将是AP preciated!

Any help would be appreciated!

推荐答案

提示:鸵鸟政策使用localhost,使用类似42foo.com,xip.io等

Tip: Don´t use localhost, use something like 42foo.com, xip.io, etc.

42foo.com具有始终解析到本地主机通配符DNS条目。

42foo.com has a wildcard DNS entry that always resolves to localhost.

42foo.com
foo.42foo.com

xip.io解析为一个特定的IP联系地址,你可以给它:

xip.io resolves to a specific IP adress you can give to it:

127.0.0.1.xip.io
foo.127.0.0.1.xip.io

这篇关于如何访问通配符子域在本地主机(.NET MVC 4)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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