如何访问通配符子域在本地主机(.NET MVC 4)?通配符、主机、MVC、NET

2023-09-07 09:00:17 作者:胸不平何以平天下

为寻找谢谢!

我开发的.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 - 有没有问题。我跟着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
 
精彩推荐
图片推荐