Get Visual Studios to use subdomain?

2019-04-07 23:26发布

问题:

While writing an asp.net project i may have this url for testing/debugging

http://localhost:1234/

I have code that takes in account of subdomains. Can i make visual studios call the same code with

http://anysub.localhost:1234/

回答1:

You can update your hosts file and put in any subdomin for the localhost:

127.0.0.1    example.com
127.0.0.1    sub.example.com

You can then point your browser to either domain. So long as the debugger is attached to IIS/Dev browser, you will be able debug your server side code.