IIS 7.5 URL rewrite based on domain name - asp.net

I'm currently using IIS 7.5 to both host ASP pages and as a bridge to a tomcat server setup to host JasperReports. I've been trying to figure out how to host both of these services with 1 IP and one IIS server.
What it should do
1) When the account managers visit admin.mycompany.com, I'd like to display the ASP pages in IIS. under the domain admin.mycompany.com
2) When the account managers visits reports.mycompany.com, IIS should act as a bridge to the tomcat server and display the tomcat pages under reports.mycompany.com
Restrictions
1) Our hosting provider refuses to give us a 2nd IP, and
2) I'd prefer not to install Apache, which can easily do this with virtual host.

This question can be resolve with https://serverfault.com/questions/47537/can-iis-be-configure-to-forward-request-to-another-web-server
I copied vdboor's answer here for reference:
For IIS 7.5, Microsoft provides official modules for this!
URL Rewrite: http://www.iis.net/download/URLRewrite
Reverse proxy: http://www.iis.net/download/ApplicationRequestRouting
In the site settings, you'll get an "URL Rewrite" icon.
Open it
right click on the "inbound rules list"
Select "Add Rule(s)"
Choose "Reverse proxy"
In this dialog you can enter the hostname + port to forward to. After adding the rule, opening the edit dialog offers more customizations.

the reverse proxy template is not available at the server level.
- so you need to go to the site level, and then click the 'URL rewrite' icon to be able to use this template.
http://forums.iis.net/t/1183318.aspx

Related

can't get my web site, on IIS, to work with URL beginning with www

I added my vb.net web app to IIS 8 on my Azure Windows 2012 server R2 VM.
Then, I did IIS > right-click Sites > Add Web Site
and set "Site name" to my_site.org
and set Physical path to project directory for my web site
and set "Host name" also to my_site.org.
Works great. From Internet, I browse to http://my_site.org and it runs OK.
Now I want people to also browse to www.my_site.org
but when I Add Web Site, just like above, but for www.my_site.org
it adds ok, but when I select www.my_site.org and click IIS Browse www.my_site.org browser pops up but reads "webpage cannot be found"
Nor can I browse it from Internet.
Because what is WWW? essentially that is a subdomain that you would need WWW to exist for it to load WWW.
Best option may be to set up domain forwarding to WWW, maybe a CNAME in your domain options?
From Azure documentation, "You must also provide the domain or subdomain alias for the CNAME, such as www if you want to create an alias for www.customdomain.com. If you want to create an alias for the root domain, it may be listed as the '#' symbol in your registrar's DNS tools."
More at:
https://azure.microsoft.com/en-us/documentation/articles/cloud-services-custom-domain-name/
Hope this helps! :)
Shahed

How to redirect a binding in IIS 7.5 (Windows 2008 R2)?

I have a "Default Web Site" with different apps under it... I have setup a HOST (A) record for a DNS name "support.mydomain.com" which points to the IIS server.
In the IIS bindings, i have configured the new HOST (A) record binding, what I would like to do is redirect any requests going to support.mydomain.com to a folder under my "Default Web Site" wwwroot.
As shown in the pictures, I'd like to redirect anything going to support.mydomain.com to the Default Web Site > App > SI folder.
Right now, it shows the standard IIS7 "welcome" page which is at the root (Default Web Site).
Any ideas?
Thank you.
You will need to use IIS URL Rewrite module for this.
http://www.iis.net/learn/extensions/url-rewrite-module/using-the-url-rewrite-module

configure hostname for wordpress site using webmatrix

How can I configure a wordpress site built using webmatrix on windows to run on a specific hostname instead of localhost with a port number.
For example my site is currently running on http://localhost:64044/
I need to be able to view it via http://www.mydomain.co.uk
I know I can edit my hosts file in windows to point my domain to my local pc like so:
127.0.0.1 www.mydomain.co.uk
but I cant see how or where to configure hostname bindings for the wordpress site in webmatrix?
probably you can't do it directly from WebMatrix. But you can do it manually by editing IIS Express configuration file %userprofile%\documents\iisexpress\config\applicationhost.config (WebMatrix uses IIS Express web server). Take a look at following posts
Binding IIS Express to an IP Address
Is it possible to use custom host headers / bindings with IIS7 Express?

IIS 7 Disabling "Require SSL"

Deployed an ASP.NET application to our internal production server as a virtual directory under the default web site. I had been getting 403 errors when trying to connect to it. So I verified the folder permissions and when I went to look at the IIS (7) SSL settings I saw that "Require SSL", "Require 128-bit SSL" and require client certificates have been enabled. This application does not need SSL.
The problem is that these checkboxes and radio buttons have been greyed out and I can't seem to figure out how to disable them. Also, in the upper right hand corner of the IIS manager, I see in the alerts box "The site does not have a secure binding (HTTPS) and cannot accept SSL connections.
How do I disable the SSL settings?
For anyone else having this issue, here is what I found that cleared the SSL configuration:
appcmd set config "Default Web Site" /section:access /sslFlags:None /commit:APPHOST
That was a bug in IIS Manager, the workaround is to temporarily add a binding using SSL so that the checkboxes become enabled, then uncheck them, and remove the ssl binding.
ALternatively using AppCmd, or Configuration Editor (in IIS Manager) you should be able to achieve that as well.
Just open IIS Manager, navigate to the site using the Tree view, and double click Configuration Editor, then select system.webServer/security/access in the section list. Change that value to None.
If your application has no relationship to your Default Site in IIS, you should really create your own Web Site in IIS so that you are completely isolated from the settings you would inherit from running in a virtual directory.
In the Bindings for your new site, distinguish your site from the Default Site by using a different port or alternately use a different domain name, such as a sub-domain of the domain used by the Default site (requires your internal DNS to be updated to support this new domain).

Friendly URLs for localhost ASP.NET websites

I Use Visual Studio 2010 with ASP.NET 4.0 and IIS7.
When I open my site, the URL looks like this
http://localhost:6549/Website/help/tab/contact-us
I want a friendly URL:
http://mysite/help/tab/contact-us
or anything that will help me to get rid of the Port 6549 from URL
http://localhost/Website/help/tab/contact-us
I use ASP.NET Development Server which is what Visual Studio use when you run a localhost website
Wait !! Please make distinction between "Properties window" and "Property pages" of the project. I always tried your advices, but using "Property pages", and there is no such property like Use dynamic ports on that page. This property can be found only in the "Properties window"
Assuming it's the ASP.NET development server:
To get rid of the port number you need to do this
- go to properties of the project
- click the web tab
- check the specific port and assign 80
There is also a virtual path setting here which you could set to /
Is your solution configured to use IIS and not the ASP.NET Development Server? There is also a property on the web application where you can specify the port (or allow for a random port to be chosen) - port 80 is the appropriate port - this requires administrator access to the process that is launching the web site.
Edit:
I was thinking you can use your host file to redirect the user, but I checked and you can't redirect to a port.
If you have IIS7 on the machine, just make the location of your web development folder into a virtual directory on IIS.
Then you can access it by http://localhost/website/

Resources