Share via


Can't access remote SQL server with Classic ASP website on Windows 2019 with IIS10

Question

Wednesday, October 9, 2019 2:43 PM

My classic ASP websites are currently installed on a Windows 2008 server using an MSSQL database 2012 on another Windows 2008 server.  They work!

I am trying to move the websites to Windows 2019 server with IIS10 with the database remaining where it is.

On the Windows 2019 server, the websites work from within Visual Studio when they are using the default web server.  But they fail when using IIS10 with the error message "An error occurred on the server when processing the URL. Please contact the system administrator".

The code is as follows:

Dim strConnection
Set ObjConn = Server.Createobject("ADODB.Connection")
strConnection = "DSN=xxxx; Database=yyyy; UID=aaaa;PWD=bbbb;"
objConn.Open strConnection

The error is caused when I call objConn.Open strConnection.  It seems to me that the code can't connect to the database.

I've set a connection to the remote database in ODBC data sources, which test successfully but doesn't fix the problem.  I've also added the connection string to the domain in IIS in the format "Server=wwww.108;DSN=xxxx; Database=yyyy;UID=aaaa;PWD=bbbb".  But this doesn't fix it either.

What am I doing wrong?

Your help would be much appreciated.

Thanking you in anticipation.

Roger

All replies (3)

Thursday, October 10, 2019 1:39 AM âś…Answered

Hi,

Try to enable the detailed error message for classic asp site in iis and check the what is the actual cause of the error:

  • Open iis manager and select your site.
  • Double click the ASP icon to open the ASP page. Expand the Debugging Properties node and set Send Errors To Browser to True.

  • After doing chnages click on Apply to save the changes.

This is not enough to get a detailed error message. At this stage, it will only show the error defined by Script Error Message.

  • Go back to the IIS properties and open the section for Error Pages.

  • In error, pages click on the edit feature setting from the action pane.

  • Select the Detailed errors radio button and click ok.

  • Restart the iis and browse your site and check the actual error message.

Regards,

Jalpa


Thursday, October 10, 2019 9:03 AM

Many thanks, Jalpa.  Fix it!

The detailed error message said that there was an architecture problem between the connection string's driver and application.

In ODBC on the server, I was using SQL Server driver.  Changed this to ODBC driver 17 for SQL Server and - bingo!

Much appreciated.

Roger


Thursday, October 10, 2019 9:06 AM

I am glad that your issue is resolved.