Create subdomain - IIS7 - asp.net

Maybe some one can help me understand why i can't create sub domain. My site is working fine for
mydomain.com and www.mydomain.com
but when i added staging.mydomain.com to the bindings i can't reach to that address for some reason. i read a post here that someone mention the app.config handler setting but i don't know what.
thanks.

What is happening is that your hosting provider probably has set host names for your site for www.mydomain.com and domain.com, however you would need to ask him to add staging.mydomain.com to the list of host names.
unfortunately IIS does not support wildcard host headers, so you will need to specify the actual host names that you need (that is unless you own the IP address at which point you could just use * which will allow any Host name to be seen there and you could use URL Rewrite to do cool stuff, but owning the IP is rarely the case).

Related

How can I host my website's root url ('/') on one hosting provider and every other url on another?

So I have a domain(example.com), where I want the root url
example.com
to direct to my landing page's DNS that comes from its hosting provider and I want every other url
example.com/whatever-here
to direct to my main hosting provider, which is digital ocean with its DNS. I did it before, but with subdomains. The example.com part was directing to my landings and their hosts, while everything that started with the "app" subdomain (app.example.com) directed users to my main hosting. Now I want to do it without introduction of subdomains. Is it done somewhere on Nginx level? Or is it configured in my hosting providers' settings? Couldn't find the answer so far.
You can't.
The hostname indicates what server your browser is going to connect to. The requested path is then sent to that server, only after the browser has connected to it.
Just as #Brad said, it's impossible to directly host a domain name on two different DNS'es simultaneously. However, I managed to find two approaches that don't do what I wanted, but the end result is pretty much the same:
Host www.domain.com on one server and domain.com on another. Not all providers support it, so it's a not guaranteed-to-work solution. But it's still a solution.
Use Nginx's proxy-pass without redirect or a similar function of your webserver.
This way, you can have example.com actually load some-other-site.com without changing the browser url. I'll provide my Nginx configuration for reference:
location = / {
include proxy_params;
proxy_pass http://other-domain-or-ip.com/;
}
This is just the result I wanted and it makes me think that I fell victim to the X->Y problem here.

How do I give access to another computer on my network, to my website hosted locally?

We have a local instance of IIS 7 running with a website. Instead of the default "localhost" we have something like, mysite.compname.com. This is a separate entry into IIS 7 and the default website was removed to prevent confusion.
Then in our host file we an entry like this:
127.0.0.1 mysite.compname.com
Now when I try to hit this url, http://127.0.0.1/ApplicationName/Project/AddProject.aspx technically it should work, but instead I get a 404. I can vouch that this isn't a problem with the application, because if I navigate to http://mysite.compname.com/ApplicationName/Project/AddProject.aspx it works fine.
My end goal is to be able to give someone my computer name, so that they can visit a test page, so the url above I think would get turned into this http://computername/ApplicationName/Project/AddProject.aspx. Any help or at least links to understanding would help because I'm not sure where my issue is coming from.
It sounds like the IIS site / application is configured using a Host Header.
This means that the site will only respond if the host header sent by the browser matches the one configured for the site.
This is a standard method to allow one server to host sites for many host and domain names.
If you wish to allow others to view the site on your computer you will need to either have a local DNS server which you can edit, or, probably the easiest option, get them to edit their host files to include
<your IP> mysite.compname.com.
Remember to open the requisite ports (probably only 80, maybe 443 for https) in your firewall.
Or, you can try to edit the site config to remove or modify the Host Header requirement. See the first link for details, but be careful, it's easy to break things if you don't know the entire architecture of the site.

Different output for http and www versions

I have a domain ie: foo.com
when i type http://foo.com , it goes to my app.
When i type www.foo.com it goes to default IIS page.
I am using plesk 9 for windows.
When i use nslookup to look up DNS they both point to same DNS.
In the IIS application go to bindings, and make sure BOTH www.yourdomain.tld as well as yourdomain.tld are binded. (PS. This question might have been better off at serverfault.com)
If the two domains points to the same IP address, it seems you need to properly configure the Host Headers of your IIS server.
Using Plesk, i think you just have to add a proper alias in the domain management page.
Changes which made in domain's configuration directly in IIS(not via Plesk) will be reset in future(after domain configuration update in Plesk)
In Plesk 9 you can switch on 'www' for domain on Hosting settings page, there is check box "WWW prefix" from left of domain name.

Multiple Domains to Single Site & IP in IIS7

The server I have at my disposal has only 1 IP available and I'm trying to host multiple domains/applications. As known DNS records will not allow sub directories, so this has to be handled through IIS. I found some information online about this topic but not anything solid for IIS 7.
From what I've read this can be achieved elegantly through the use of HTTP/Host Headers. I'd like to avoid using redirects or URL Rewriting. If you're familiar with this topic or other workaround and can provide some instructions on settings this up it would be highly appreciated.
Thanks!
You can specify a host name under the binding in IIS 7. Note that you cannot do this with HTTPS binding.
In your case, you would select the IP address (or leave it as All Unassigned), and for your host name enter it, such as "mysite1.com". In a different website, do the same thing except use that host name, such as "mysite2.com".

How to set up subdomains on IIS 7

I have a website sitting on an IIS 7 server:
WWW.example.COM
I would like to create several sub domains that looks like
SUBDOMAIN1.example.COM
I created an IIS website and I set the bindings to be
http, port 80, the ip address of my server, and SUBDOMAIN1.example.COM and the physical path to a folder under example.COM
I restarted my website and clicked on browse, the browser than opened with the address:
http://SUBDOMAIN1.example.COM
But the website doesn't show up.
Do I have to do something with the DNS?
This one drove me crazy... basically you need two things:
1) Make sure your DNS is setup to point to your subdomain. This means to make sure you have an A Record in the DNS for your subdomain and point to the same IP.
2) You must add an additional website in IIS 7 named subdomain.example.com
Sites > Add Website
Site Name: subdomain.example.com
Physical Path: select the subdomain directory
Binding: same ip as example.com
Host name: subdomain.example.com
Wildcard method: Add the following entry into your DNS server and change the domain and IP address accordingly.
*.example.com IN A 1.2.3.4
http://www.webmasterworld.com/microsoft_asp_net/3194877.htm
If your computer can't find the IP address associated with SUBDOMAIN1.example.COM, it will not find the site.
You need to either change your hosts file (so you can at least test things - this will be a local change, only available to yourself), or update DNS so the name will resolve correctly (so the rest of the world can see it).
As DotNetMensch said but you DO NOT need to add another site in IIS as this can also cause further problems and make things more complicated because you then have a website within a website so the file paths, masterpage paths and web.config paths may need changing. You just need to edit teh bindings of the existing site and add the new subdomain there.
So:
Add sub-domain to DNS records. My host (RackSpace) uses a web portal to do this so you just log in and go to Network->Domains(DNS)->Actions->Create Zone, and enter your subdomain as mysubdomain.domain.com etc, leave the other settings as default
Go to your domain in IIS, right-click->Edit Bindings->Add, and add your new subdomain leaving everything else the same e.g. mysubdomain.domain.com
You may need to wait 5-10 mins for the DNS records to update but that's all you need.

Resources