How do I get IIS to direct traffic to other binded directory - iis-7

I have two sites configured on my IIS 7 server. One is the default web site and the other we will call www.othersite.com. The default web site runs a few different Applications running ASP.NET and the other site is a ColdFusion 8 web site.
The default site is configured to pull from the default web location at C:\inetpub\wwwroot while the other is set to pull from C:\sites\othersite.
The bindings are set to send all unassigned traffic to the Default Web Site, but www.othersite.com is set to a specific IP address. This is the same as I have it on other servers, which work perfectly well, but for some reason when I load www.othersite.com it is looking for its files in C:\inetpub\wwwroot instead of C:\sites\othersite even though the physical path is clearly defined in the basic settings.
Anyone have any idea why this might be and how I can get it to point to the proper directory?

Under IIS >> Bindings, you can see a place to put in "Host name". Leaving blank will result in all traffic to IP or host, but by specifying a host name (www.othersite.com) will direct traffic to that dir/site.

Related

Host ASP.Net MVC Site

I've created a site using ASP.Net MVC that is meant to be stored on a local machine at my place of work. The intention is to have the site stored on this machine, but then accessible by all the other machines within this building.
I've followed Microsoft's tutorial as well as Code Project's tutorial, but I am not having very much luck. The binding is just the localhost, port 80, with * for the IP address. The URL is localhost/GrantTracker.
I've opened the ports within the firewall, checked the permissions on the directory (which is just within wwwroot), tried having the site take the place of the default IIS site (as Microsoft tutorial has you do) and tried having the site stand on its own with its own port (per Code Projects tutorial).
On the host machine I am receiving the standard "This site can't be reached, localhost refused to connect" which feels like either a port or permissions problem. I must be missing a step, but I can't seem to find what it would be. I am new to hosting sites through IIS so forgive me if I am just missing something basic.
I find it a bit strange too because my project uses Windows Authentication and when the site is first visited it performs that initial check with the user, authenticates, but then throws me the error.
Anyone have any ideas? Thanks in advance.
start simple,
create a simple html page, create an IIS application for it, on port 80.
Check and make sure you can see that page from another computer using the internal IP address of the the host machine so something like:
http:\\192.168.0.3\hostapp\test.html .
You can see the proper URL by running it from IIS, this will give you the entire URL you need, with localhost then just replace localhost with the IP address of the host machine to see it on other machines.
Do this in the original IIS folder so you don't encounter any folder permission issues. If you choose another folder you'll have to give access to the Network Service user ( i think, can't remember now, but there is a specific user that needs access to the folder where the website is deployed )
if you can see the page then deploy a proper website and do the same thing. Make sure the app pool is created correctly and it's up and running, then access it again on other computers and it should work.
Port 80 should be open by default so that should not be an issue.

How to create Application in the IIS Default Web Site root (virtual path : '/')?

Context
I have an Asp.Net MVC application. I would like to deploy it to an IIS (Windows Server 2016). I do not care which will be physical path, but I would like to access to the application in the virtual path '/'
(I am using Package web publish method, because no online access to the server, but I think this question is on IIS/ASP and not about publishing. I clearly miss some basic concept about IIS/ASP.)
What I've tried
1) When I try to create an Application in IIS then the dialog forces me to add an application Alias, which becomes the part of the virtual path. So regardless the physical path now the the url will be
myserver/myapp/mypage instead of myserver/mypage
which is not what I want. I would like to access to the page as myserver/mypage
2) If I simply deploy the app under wwwroot then it will appear as myserver/mypage it seems to be working, but where is the "Application" this case? (see picture).
Question
Maybe I missing something: Is this the Default Web Site is an "Application" in its own right? How to configure then its Application settings? If not, then how can I create an Application which's virtual path is '/'?
If I have understood your question correctly, you want to access the application as servername/pagename. In order to do so, do not create an "application" or "virtual directory" under a "website". Instead, directly host the content under Default website. You can change its path under "Basic Settings" and point it to your content folder.
You can also create another website at port 80 and point it to the location where your content is present. However, you will not be allowed to create 2 website with the same IP-port-hostname combination. You can solve this problem further in 3 ways.
If Default web site is not in use, then instead of creating another website, click on Default website, select basic setting from right hand panel and change the path to application content folder.
If Default website is in use, then create another another website at port 80 with a hostname.
If you do not have a hostname and are accessing the application using server-name, then you will have to modify the port to 8080 or something like that.
Refer my blog - https://blogs.msdn.microsoft.com/parvez/2016/07/27/iis-bindings/ for more information about IIS bindings

Deploy web site without using a domain

I am new to the web world, so I apologize if this question is silly.
I have an ASP.NET web site I wish to deploy.
The server has IIS 7 deployed on it, and I've added the site
to that IIS server as a web site.
For the time being I don't have a domain mapped to the site,
I would like the users to browse for the site directly by using the server's IP.
Is that even possible? because I failed to do it.
The only option that worked so far is using the hosts file to declare
a fake domain.
It would be nice if someone could clarify that issue for me.
Thanks a lot,
Omer
If you set the site bindings to IP address: All Unassigned on port 80, and do not provide a host name, then any request that makes it through to IIS should be served by that site. Make sure you stop any other sites that might have that binding (e.g., "Default Web Site" is normally bound to this).
In order to access the site by IP, you can't have the host name populated in IIS. Your best bet would be to use the "Default Web Site" that's already in IIS, and point that to your application.
Using IP is possible, but you need to make sure your users can see this ip from their machines.

IIS7 and Classic ASP and Applications and Paths

I yesterday received a zip file containing an old asp site from 2005. Its came in a folder called ivx.
I've unzipped ivx to c:\inetpub\wwwroot and then created an application in IIS called ivxapp and pointed it to c:\inetpub\wwwroot\ivx. Now when I type http://localhost/ivxapp, I am able to access the index page.
My problem is, whoever designed that site, designed it when IIS5 or IIS6 was around. He's used paths like more... which leads to http://localhost/new_posts.asp and not http://localhost/imagevertex/new_posts.asp
The whole site is some 21000 lines of code and contains many many references like this. Then comes the problem with <!--#include virtual = "/common/adminverify.asp" -->
Instead of having to manually edit the entire code, do you know a way to get things going?
This site worked perfectly well on a production server. Right now it's on my local machine on Windows 7 64 home premium.
Yes, you need to give this site a root-URL of its own, and not run it in a subdirectory of your localhost.
This is more of a web-administration question, but what you need to do is either run it under "localhost" directly, or add a domain-name to your network to run this site under.
The easiest for you right now is probably the first option.
If you aren't running a different site under localhost already:
Go to the IIS manager and click the 'localhost' site. On the right side of the IIS interface you can change the basic settings. Point the physical path to the ivx directory. You can reach the site directly on http://localhost.
If you are already running a site under localhost you need to keep:
Now, if you -are- already running a site on your localhost, the second easiest option is to run the ivx site under localhost, but on a different port. To accomplish that, click on the current ivx site in IIS, change the path in the same way as descibed above, and after that click on "bindings" in IIS, and change the PORT for the ivx site to something other than 80, for example 81.
The ivx site will then run on http://localhost:81, your current localhost will still run on http://localhost.
The hard way: adding a host to your network or PC:
The last option is to add a new hostname for the site to your network. You can add an A-record in your DNS for the ip-address of your server or add a host name to your HOSTS file in Windows on your server ("server" in the sense of the machine that runs the site, which can also be your local machine)
You can add a made-up name to the ip-address of the server, and in IIS' bindings add that name under "host name". this way you can run two different sites on the same machine, the "host name" seeting in IIS will make sure that calls to that specific hostname will reach the correct site. Adding it to the DNS of your network, or the HOST file in Windows will make sure the name is resolved to the correct machine (your webserver).
This last option is a little tricky of you've never done something like this before, but the first option works just as well.
Good luck!
Erik

web services on a dedicated port within an ASP.net web site

Is it possible to have a web service within an ASP.NET forms web site run on a different port, sort of like how SSL has a dedicated port?
The service needs to see the app_code folder in the existing site and of course app_data.
Any links to articles or tutorials would be greatly appreciated.
You can have several different ports bound to a website in IIS, however if you bind that port, it will work on the whole website. You can't bind a port specifically to a directory within a site.
So you can have a secondary port (ex: 8080) added along with a hostname through the website bindings in IIS.
If you don't want to have the rest of the site (that's not the web service) to respond to the secondary port, you would have to do it through either code, or configuration.

Resources