WebMatrix Host File - webmatrix

Is there any way to do a redirect to a WebMatrix address like you would using a host file: 127.0.0.1 localwebsite.com.
I can't use computername:2000 in the host obviously, so how can I use my localwebsite.com with WebMatrix/IIS Express?

From Stefan Schackow:
You need to tweak some local machine settings to allow IIS Express to bind to port 80. As long as you can’t use port 80, all of your local Urls will have “:port#” in the Url, which defeats the ability to run arbitrary hostnames against the web server by way of faking out DNS with your local HOSTS file.
I see there is an article on learn.iis.net that explains how to ACL http.sys to allow IIS Express (and other apps) access to port 80: http://learn.iis.net/page.aspx/1005/handling-url-binding-failures-in-iis-express/ The section titled “Using a Reserved Port” has the info.
Once you have done that, you should be able to do the usual tricks with the local HOSTS file, as well as configuring websites with specific host headers in IIS Express – and everything should work.
-Stefan

Related

Is it possible to install localhost server in one pc and to access on multiple computers on a same network.?

We are building php web application while i am a designers and my friend is developer we work on different pcs we want to test the file by runnig on localhost on both of our pc how can we reach it. I have gone through some of concepts in internet but didn't get proper info.
Yes. You need to create a firewall rule to allow access through whatever port you are serving on, probably 8080.
Here is how to create an inbound port rule in windows
Then they should be able to access your server by simply using your ip

Instead of IP Address use Hostname in IIS 7

I have a simple project in asp.net mvc3 I publish in my local PC and using my IP Address to open it. I try to use the hostname that I set in the IIS but it will not open the project. How to use hostname in IIS7?. Anyone knows?.
To add a hostname in IIS7 follow this procedure from Microsoft:
Open IIS Manager. For information about opening IIS Manager, see
Open IIS Manager (IIS 7).
In the Connections pane, expand the Sites
node in the tree, and then select the site for which you want to
configure a host header.
In the Actions pane, click Bindings.
In the
Site Bindings dialog box, select the binding for which you want to
add a host header and then click Edit or click Add to add a new
binding with a host header.
In the Host name box, type a host header
for the site, such as www.contoso.com.
Click OK.
To add an
additional host header, create a new binding with the same IP
address and port, and the new host header. Repeat for each host
header that you want to use this IP address and port.
This configuration means requests received by IIS for this hostname will be sent to the specific site you have configured.
However you need a configuration for requests to actually arrive to this IIS Server and this is where DNS is used.
Your server can be found via its IP(s) address(es). Here you want your server to be found via a hostname, so you need a configuration somewhere which says your hostname points to your server IP.
If this is for an intranet site, ask your network team.
If this is for an internet/extranet website, you need to buy a domain name, and your provider will allow you to make the DNS configuration.
If this is for local (windows) use only, you can bypass DNS by using the hosts file. Check this page for example. The hosts file allows you to tell your local computer to point a hostname to the IP of your choice.

Different port make the DNS useless

I use XAMPP to make a website but I have the other Website use IIS so I couldn't use port 80. So I use port 8888 at XAMPP Apache for Windows OS.
If I type HTTP:/URL (my IP):8888 I could link the website, but when I use the DNS name such as shop.example.com.tw(just example).then It's not work.
I know it need to set virtual host and name base
but the default document is use port 80
How could I make the shop.example.com.tw work by port 8888 and the client-end
don't need type shop.example.com.tw:8888
Domain Name Services (DNS) only links a (sub-)domain name to an IP address, it does not deal with IP Ports.
So the part you have listed as "URL (my IP)" would be replaced with the domain name, e.g. "something.mydomain.com". You need to still put the port number on the end because you are directing your client browsers to a non-standard HTTP(s) port. The standard ports being, of course, 80 for HTTP and 443 for HTTPS.
If you want to direct a local port to a standard one externally, you need "Port Address Translation" (PAT) which is commonly available on routers. Or you need a proxy that will do the PAT for you.
Both Apache and IIS can do such redirections.
So the transformation is done in two steps:
http://sub.domain.com:80 --> http://1.2.3.4:80
http://1.2.3.4:80 --> http://1.2.3.4:8888
DNS takes care of the first, PAT or Web Server configuration or proxy server takes care of the second step.
Below are some examples for Apache. Note that personally I no longer use Apache as I find NGINX more performant and better to configure.
Apache redirect to another port
http://www.ubergizmo.com/how-to/how-to-set-up-port-forwarding/

Local URL IP redirect via port

I do a lot of custom web development and I am looking for a solution to a problem with testing.
I have a local development server that I run sandboxed environments on. When I need to test something I sometimes will edit my host file to make the domain point at my local IP
In my host file I would have.
127.0.0.1 mydomainname.com
What I would rather be able to setup is if I added a port to a URL:
mydomainname.com:7777
That would then redirect to my local IP
Something like this
127.0.0.1 *:7777
Is this a pipe dream or doable in someway?
You can use Firefox Extension Server Switcher
This firefox extension is a tool for web developers and allows switching between sites on your development and live servers; it helps you to see difference immediately.
It's more easy in use than host file.

GoDaddy Multiple website hosted on Dedicated Server issue

I'm using my friend's dedicated server where he hosts 2 of his websites to host my own, but I'm not familiar with registering domains, and I can't get my domain to point to a specific port I use so that my website doesnt clash with his. He has 2 websites that according to IIS are using the SAME PORT, I installed XAMPP so I had to use the 8080 port, how did he register two different domains for websites hosted on the same ip under the same port? and how do i point my domain to my 8080 port? (using apache)
You need to use host headers to prevent conflicts if you're sharing the same IP, else you need your own IP. With the appropriate dns settings, and host headers setup in iis, you'll never conflict with his sites (that should also be using host headers).

Resources