IIS7 - Using an ip address and port number will not display a web site home page but using localhost will - asp.net

Using ASP.Net I did a web site and can load it up in a browser window when pressing the F5 key in VS2010.
On the browser window I noticed VS2010 used an address like this to load the web site home page:
localhost:12345/
If I try to use the ip address for my computer found by using ipconfig to load up the home page,
1.2.3.4:12345
I get an error stating:
Could not connect to 1.2.3.4:12345
If I use:
1.2.3.4
I get the IIS7 default page.
The actual address and port numbers I used in this example are different than those I really used.
Can you tell me why localhost works but 1.2.3.4 does not work?
Can you tell me if I need to do something extra with IIS7 since I never did this before?

A couple of things to remeber. Your computer two types of IP address. The first is a private IP address and the second is a public IP adress. IPConfig will show you your local, private address. Your private address will not be accessible from anywhere outside your LAN.
If you would like to change your websites URL locally from localhost, you need to change your IDE's development settings.
This site has a great tutorial on how to do that.

First things first, the address Visual Studio gives you is a temporal address that corresponds to their development server (Webdev.Webhost or Cassini), this server doesn't allow you to connect outside your computer, that's why localhost:1234 opens your page, but 5.6.7.8:1234 doesn't.
Second, also you seem to have IIS configured, but what you need to do is deploy your site to IIS, here are Microsoft information about deploying your site: http://msdn.microsoft.com/en-us/library/20yh9f1b(v=vs.100).aspx, once deployed, you may create an Application on IIS or a Virtual Directory, for more information you can take a look here: http://technet.microsoft.com/en-us/library/cc772042(v=ws.10).aspx.
Once you have deployed and configured your application or virtual directory, you can access your site like this: localhost/MyVirtualDirectory (assuming you set a virtual directory).

Related

how to configure IIS for a specific website nam

Hi everyone,
I have configured my web application using IIS7. It is running fine for http:// localhost/, but I need to give some website name like http://myexamsystem.com/
instead of "localhost".
I have tried all the possible ways from IIS7, but I am not getting the result.
Steps I did upto now:
Step 1: Right Click on "Sites".
Step 2: Selected "Add Website" option.
Step3:In "Add web site" dialog box:
Site Name:"myexamsystem", Application Pool: "DefaultAppPool"
Physical path: "desktop\myproject folder"
Binding
Type:HTTP, Ip address "All Unassigned", Port:80
Host Name: "myexamsystem.com"
OK
Error Messege:
This page can't be displayed
•Make sure the web address http://myexamsystem.com/ is correct.`
If this is just for debugging / local development, then you'll need to add an entry in your HOSTS files. This is located:
c:\windows\system32\drivers\etc\hosts
It can be edited in notepad (if you have administrator rights on your machine). You just add the following entry:
127.0.0.1 myexamsystem.com
Note that this will only work locally. If you want it public, then you'll need to buy the domain name and point it to an external IP address.
Update
Just seen your comment about it needing to run on your local network. A quick way is to add your internal network IP address to each machine's HOSTS files. You can find out your internal IP address by typing ipconfig into the command prompt. Then add it to the HOST file of the other machines in the same way as I descibed above, except use your internal IP in their HOST file rather than 127.0.0.1.
If you don't want to manually add them to each computer, then as far as I know, you'll need a DNS server.

IIS website inaccessible from server (but ok from outside)

On a server where an IIS website is hosted, if I open IE or Firefox and type the IIS website url, i got an error after a few seconds ("Cannot display the webpage", just like website would be offline). If I do the same from the exterior (as normal user do) everything works.
I have tried to give the IP address directly (thus skipping DNS), problem is the same. It only works if I type the internal ip address of the IIS website (eg : 10.0.0.x).
The reason I want to do that is that I need to access a specific page of the website in order to execute a scheduled task. I cannot use internal ip address to do that, because host name (HttpContext.Current.Request.Url.Host) is used inside ASP.NET code to switch between different configuration.
Here is my question : is it possible to access a specific page on a IIS website from server where website is hosted ? (using complete url, not internal ip address ?)
Yes - If I understand your question correctly you should be able to add a mapping in your local hosts file to point that domain at your IIS webserver.
e.g.
10.0.0.x my.example.hostname
(where x is obviously a number)
We use this configuation internally when developing multiple sites on our local machines - each site is bound to a specific hostname and all these hostnames have mappings in the 'hosts' file to 127.0.0.1
The same principal applies here, if I've understood the question correctly :)

use local machine IP address to test website on local machine

Hi i am developing a website and want to test it on local machine
the flow is like this:
A -- my website
B -- third-party website
From A a request is sent to B with a url eg: http://mywebsite/abc.aspx which is a url on which B reports success or error.
so i need to define the url to report to
for this i need to give a absolute url or path.
thats why i cannot test it on local machine and have to upload it and test it.
but this doesn't allows me to track down errors and debug it.(through break points.)
so i am trying to get the local machine address like "http://123.456.7.8/abc.aspx"
but doesn't seems to work.
my pc is running on windows xp and is connected to router and my pc is in a network and i think that's why gets a dynamic IP.
have also tried public ip address but no luck.
any work around or help for this.
I believe you're trying to get an external website to contact your local PC. Your local PC is behind a router and getting a private IP from your local router.
You'll need to supply the external website with an address that has the external IP of your router and configure your router to forward incoming requests to yuor PC.
i.e. to forward port 80 on the router to port 80 on your XP machine.
Thus when the external website, tries the contact http://1.2.3.4/abc.aspx it will talk to your router, that will then pass ("forward") the request onto your PC at e.g. http://192.168.0.1/abc.aspx.
I believe You can try to use your Machine name.
You can set up a local DNS server or simply utilize hosts file, to cheat your web browsers. For example, register test.com to your machine's IP address, and then you can use http://test.com to access IIS default web site (or your web site on IIS if you configure it for the default URL).
http://en.wikipedia.org/wiki/Hosts_%28file%29
This is a typical approach to test out web application locally.
try hosting your website on IIS and then give fix IP to your system and try to access it with your IP. Another thing is get your global IP (you can check it from Whatismyip.com ) and set it in your binding in IIS for getting request to it from across the internet.

Cannot access web application (Internet Explorer Can Not find this Page) remotely

I have Deployed my Asp.net web application on IIS 7.0 on localMachine(Server) and it is working fine there.
But when i try to access it from other machine in LAN, It gives me error that, 'Internet Explorer Can Not find this Page.'
I am accessing it on terminals using server name address and also tried using IP address.
Even I have Shared the Application Folder in network.
Check the Windows Firewall on your Vista PC. You need to let TCP port 80 through.
Make sure that you enable the firewall and bind to IP addresses other than localhost.
You don't need to and should not share the application folder.
This is a security risk as people on the network will be able to access the source code of the application. Also, it won't help with the problems you're having because a network share is not accessed over HTTP and so will never hit IIS and your web application. So you can turn off sharing for the folder and be safe in the knowledge that this isn't the issue.
Next, check your windows firewall and make sure incomming web trafic is allowed ("http" or "port 80").
Next I would have a look at the host headers that the site is running on.
Then maybe update your question with more detail.
Greg
You may also want to ensure that IIS is listening on the correct IP Address. This problem can occur if you switch from a LAN connection to a wireless connection (for example when taking a work laptop home).
To Check this, open inetmgr and right-click on the 'Default Web Site' node. Verify that the IP Address entry is set to the current IP of your machine.

Getting site running in IIS 7 Issues

This is driving me nuts. I am trying to setup a webiste on our dev server with a specific url name www.mystpidsite.com as an example. mystupidsite is not the same name as the dev server.
1) specify a specific url to use for the website I create in IIS
2) run it and use that url to access it
I have:
1) created a new site in IIS 7 in Server 2008
2) attempted to access it via the site name which I set to the desired url and port 8888. So if we want it to be www.mystupidsite.com I setup the website name to mystupidsite in IIS 7.
3) I even tried to create an application under mystupidsite with the same name in IIS 7.
The server is definitely accessible and pingable on the network from my local PC, we have other stuff installed on this new server. Do I need to create an application or is just creating the website enough in IIS 7? I specified the IP as the server's IP in the website I made.
For the host name in the bindings of the site I put www.mystupidsite.com
when I try to access the site via www.mystupidsite.com it can't find it and the site in IIS7 on the dev server is running. It's running on a HyperV instance which is our dev server. Everything else has worked just fine. I just wnat to understand how to get a specific url by name setup.
Do I need to add something in the hosts file on the server or something?
You're not going to be able to have a site on your dev box answer to both the mystpidsite.com and mystupidsite.com domain names.
Unless you have the domains registered and have your domain's nameserver directing that name to your dev machine, IIS is only going to answer to requests either the machine name on the network or the IP address of your machine (in addition to 127.0.0.1 and localhost).
The only thing you're going to be able to do outside that scenario is set up two sites on two different ports on your machine and access them from http://localhost:80 and http://localhost:8888 (or network computer name equivalent).
you need to have an entry in dns to be able to hit the server when using www.mystupidsite.com
Because you have the site running on an alternate port you should be able to get to it by http://your-server-IP-address:8888
If you want to test it locally using the host name and do not have access to dns you can add the appropriate entries to the hosts file on your local machine (c:\windows\system 32\drivers\etc\hosts)
What happens when you type 'nslookup www.mystupidsite.com'? Do you get the IP address of the virtual server?
Do you have the windows firewall enabled on the server? if so, did you add an exception for port 8888?
add a default binding (no host header / blank) and try accessing it by IP

Resources