Category: Windows Server 2008

Port opened? Telnet is your friend

Do you want to know if the problem you are having is a network \ firewall issue?

You can simply use Telnet to check if the port you are trying to connect to is open or not.

You can test any port using this simple method, not just connections open to telnet.

First off you need to install Telnet Client on your machine.

To do so, open a command prompt window. Click Start, type cmd in the Start Search box, and then press ENTER.

pkgmgr /iu:"TelnetClient"

Next step close the current command prompt and reopen it again, this is so the path to Telnet which you’ve just installed will work.

Now type the connection & port to test

telnet <server> <port>

Example

telnet google.co.uk 80

If it goes to a blank screen or a screen with funny characters then this means that port is open.

If you get :

Connecting To google.co.uk..Could not open connection to the host, on port 80:Connect failed

Then you’ll need to get onto your network team to open some firewall rules for the required port access or iptables if on unix servers.

Advertisements

IIS Redirect HTTP to HTTPS

We needed to redirect from HTTP to HTTPS as some of our sites weren’t yet updated to cope with HTTPS
So instead of doing it for all sites on our IIS server we needed to do it for one to start with and leave the others intact.

This is how we did that.

First thing you need is a IIS module which isnt installed as standard, URL Rewrite. Instead of just clicking the large green button which Microsoft would like you to do, scroll down and download just the file version that you need.

Once you’ve installed this, you will need to restart your IIS on that server, we have 3 which are load balanced, so had to install this module on all 3 and restart all 3 in order to see the icon.
URLrewrite

Hopefully Microsoft wont say you need to reboot the machine in order to install this, if you do get this message then you don’t have much choice apart from do what it is saying.

Okay, now launch the ‘URL Rewrite‘ module and do the following:

Add Rule(s)…‘ then select ‘Blank Rule‘.

Fill out the following as in the following screen, under ‘Match URL‘:

MatchURL

The regular expression is as follows:

^(resultsonline(($)|(/.+$)))

Where ‘resultsonline‘ replace this with the name of application you want to jump to HTTPS

A break down of the what the above regular expression is doing:

^ = The match must start at the beginning of the string or line.
$ = Match must occur at the end of the string
| = Matches any one element separated by the vertical bar
/.+$ = / is just a slash . means Any + one or more $ end of the line, so it has to equal “/something” rather than /.* would match “/” or “/something”

In the ‘Conditions‘ section, click ‘Add…‘ and enter:

Conditions

Then in the ‘Action‘ section, change the setting to:

Action

Click ‘Apply‘ to save the rule.

Include the above with a binding for HTTPS and http://www.server.com/resultsonline will redirect to https://www.server.com/resultsonline

If you want to redirect all your sites from HTTP to HTTPS then just change the regular expression to (.*)

Hope it helps.

Problems with IIS 7?

Are you pretty certain that you’re settings are correct within IIS7, but it’s still not playing ball?

Then try rebooting your server.

Yes I know this is a very drastic measure – but this was the only thing that worked for me.

Things you could check before is the Up Time of the server, in my case I’m using ‘Windows Server 2008 R2’ view this in your ‘Windows Task Manager’ under the ‘Performance’ tab.
My server was denying me access to a SQL server with the following error; which I knew existed and worked when using a local version:

[SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 50 - Local Database Runtime error occurred. Cannot create an automatic instance. See the Windows Application event log for error details.
)]

I’m sure that having my server running for over a 150 days had caused it to get itself in to a tizz, with updates that had been installed but not running etc.