Monday 15 September 2014

Windows 8, Skpe and IIS

I finally took the plunge and upgraded my HP Folio 13 to windows 8.1 over the weekend. I bought the laptop just before Windows 8 launched so it came with Windows 7 Pro and the option to get a free upgrade. I've had the DVD sitting around for almost 2 years. This is partly due to the time it takes to backup, uninstall apps and re-install everything needed for developing in both Windows .Net environment and also NetBeans, PHP and MySQL, but also a reluctance to tackle Windows 8's perceived unintuitive UI.

As it turns out, it took around 10 minutes to figure out how to get to grips with working with the Metro interface and desktop but after that I'm finding it a great improvement. The interface is slick, quick includes some nice apps: Sticky Notes and OneNote (I've been using OneNote 2003 for years but haven't yet worked out how to copy my old data in - more on that later).

This morning I've been getting development tools installed and first on the list was IIS, installed by turning on the option from Control Panel. IIS installed fine but afterwards, http://localhost simply wouldn't open. Running IIS, the default website was stopped and starting it raised the following error: The process cannot access the file because it is use by another process. (Exception from HRESULT: 0x80070020):


Searching for this error lead me to this page on the Microsoft support site: http://support.microsoft.com/kb/973094, so I followed the advice to run netstat -aon | find ":80" in a Command Prompt to find the process running on port 80:


Looking up WWAHost, it seems this is used by the Metro interface for communicating with the internet, more specifically the Skype app that is installed automatically with Windows 8.1. So basically Skype is using ports 80 and 443 and so conflicting with the default ports used by IIS - and presumably by Apache if using WAMP. That would be fine if it were possible to configure Skype to use different ports but it seems that not an option in the app even though it is in the desktop version of Skype.

It's possible to use different ports in IIS but the default will be included in the properties of most web development projects so it's not an easy option. It seems an incredible lack of foresight on the developers' part, as many agree: http://community.skype.com/t5/Modern-Windows-from-Windows/How-to-change-port/td-p/1173550

I do use Skype so having to make the choice of uninstalling is a real pain. I may try that and then install the desktop version. Will see how that goes...

That was easy then - right-click on the Skype tile and choose Uninstall. Default web site now starts and is running fine. Desktop Skype installs OK too.

Sunday 6 July 2014

Classic ASP Provider error '8002000a' Out of present range.

One of our older websites, written in classic ASP and using a SQL Server 2008 R2 database, needs data importing every couple of months  or so from an Access database and we a have an ASP script ready to do this. It has been run more than 40 times but this month it hit a problem.

Provider error '8002000a'
Out of present range.
(and the line number)

This typically happens when trying to pass a value that is too large for the data type when using an ADODB.Connection.

But the code where it was failing was pretty simple:

sSQL = "update ARTICLE set AR_DISPLAY=0 where AR_TYPE='R'"

Call adoConn.Execute(sSQL, lRecords)

It was hard to see how this could involve any overvalued types until I tried the query in SSMS and it reported: 33826 row(s) affected. The suspicion now was that the number of records being return was too big for the lRecords value, so it must be an Integer. As it's not possible to explicitly declare this as a Long, the solution was to use a function to covert it before running the query, as below: -

lRecords = CLng(0)
sSQL = "update ARTICLE set AR_DISPLAY=0 where AR_TYPE='R'"

Call adoConn.Execute(sSQL, lRecords)