I have recently been working on getting some major applications off a Windows 2003 platform, as this platform no longer meets security requirements, as we all know Microsoft stopped supporting the servers in July 2015.
To do this process I started by using Windows Server 2003 Migration Planning Assistant and Atlassian’s JIRA to map out the key steps and outcomes. I then worked with our Service / Storage and Networks teams to get the new servers spin up in VMware and get them to open oh’so important firewalls so the new servers have the same access as the old one.
It was then a case of modelling the structure on my local installation of IIS (Internet Information Services) there were some parts that weren’t straight forward as it seems this I will explain here. I hope for your sake that your company has already migrated away from Classic ASP code.
- Global.asa – This file now needs to be in each application, rather than just one on your top level website.
- In your AppPools – Make sure that you’ve set ‘Enable 32-bit applications’ to True.
- Oracle – You still need to be install the Oracle 32-bit client, if of course your website is connecting to oracle databases using Microsoft ODBC for Oracle.
- WebDeploy – Use WebDeploy from Visual Studio to the server to deploy your code, much easier than using a FTP server also saves having to deploy to each individual server, you can write a PowerShell script which will deploy to all your servers in one go.
Install the ASP roles and features:
- On the taskbar, click Server Manager.
- In Server Manager, click the Manage menu, and then click Add Roles and Features.
- In the Add Roles and Features wizard, click Next. Select the installation type and click Next. Select the destination server and click Next.
- On the Server Roles page, expand Web Server (IIS), expand Web Server, and then expand Application Development.
- On the Server Roles page, select ASP.
- If the Add features that are required by ASP? dialog box appears, click Add Features. (This page appears only if you have not already installed ISAPI Extensions on your server.)
- On the Server Roles page, ASP and ISAPI Extensions should be selected. Click Next.
- On the Features page, click Next.
- On the Confirmation page, click Install.
- On the Results page, click Close.
How to show your debug messages on screen… I’ll come back to this in a few days, it late at night and I’m too tired to continue explaining.
The above should get you started. Good Luck!
Right, I’m back to finish off the post.
Within IIS click the server name in the left hand tree, double click ASP within the IIS panel, open up the ‘Debugging Properties‘ and change ‘Send Errors To Browser‘ to True. You can do this as described above for the whole site and all it’s web applications or a application basis. To do this, select the application name on the left before double clicking on ASP.
You might also need to switch on Detailed errors for a particular error page. Let say your page is reporting 500 not found and you know that the page is there, a index.html file in the root displays correctly (a good test of sanity). To turn these on, Double click on Error Pages within IIS panel on the site or the application as above, then select the error code on the left and click ‘Edit Feature Settings…‘ on the right.
This then shows the following dialog box, where you click ‘Detailed errors‘.
This process creates or appends a web.config file in the root of your site or application which contains the following:
<?xml version="1.0" encoding="UTF-8"> <configuration> <system.webServer> <httpErrors errorMode="Detailed"> </system.webServer> </configuration>
Microsoft OLE DB Provider for ODBC Drivers error ‘80004005’
If you’re getting this in a Classic ASP application and you’ve done all the above steps, then your Global.asa file has the wrong connection, maybe your oracle client doesnt have it in its tnsnames.ora file
Microsoft OLE DB Provider for ODBC Drivers error '80004005' [Microsoft][ODBC driver for Oracle][Oracle]ORA-12154: TNS:could not resolve the connect identifier specified /blah/blah.asp, line 26
Or if your getting something like the following then you’ve missed the ‘Enable 32-bit Applications‘ to True in the AppPool settings
Microsoft OLE DB Provider for ODBC Drivers error '80004005' [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified /blah/blah.asp, line 141
Yes, why on earth would you still be using a server which can only support IIS6?! But somethings in this world cannot be pushed into the future fast enough, in the case of our organisation there are quite a few Windows 2003 servers which are still in use, which is shocking.
So what do I need to do to get a redirect in place?
Create a blank file called HttpRedirect.htm in the directory root of your website, copy in the below code.
Set the 403.4 error page to use this file instead of the regular error file. Do this in IIS6, right click and select ‘Properties‘ on your website, click on ‘Custom Errors‘ tab, find 403.4 in the list click ‘Edit‘ and ‘Browse‘ point it at the file which you created above.
Select the ‘Directory Security‘ tab, select ‘Edit’ in the Secure Communications section
Check on the ‘Require secure channel (SSL)‘ option. (This will only allow pages on this site to be viewed only with Https.)
Now browse to a URL on this website and your be redirect from 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.
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‘:
The regular expression is as follows:
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:
Then in the ‘Action‘ section, change the setting to:
Click ‘Apply‘ to save the rule.
If you want to redirect all your sites from HTTP to HTTPS then just change the regular expression to (.*)
Hope it helps.
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.