MSXML2.ServerXMLHTTP and TLS1.2

Okay, so most webservers now have TLS 1.0 and 1.1 disabled, which of course causes code to fail. Also the case for a classic ASP script using MSXML2.ServerXMLHTTP, so Google to the rescue and found this:

It was, surprisingly, easy to convert my existing code in the actual application to use WinHTTP, which appears to work properly enforcing TLS 1.2 on all calls from XP POSReady and Windows 10 (the OS’s where this application will be deployed).

While this isn’t an answer as to why POSReady and XMLServerHTTP calls try to use TLS 1.0 on the first call (despite the registry stating that’s not desirable), it is an acceptable workaround.

For others who may stumble upon this and are hesitant, converting my code was as simple as this:

Set XMLReceive = CreateObject("Msxml2.DOMDocument.6.0")
Set XMLServer = CreateObject("Msxml2.ServerXMLHTTP.6.0")
XMLServer.setTimeouts ResolveTimeoutMs, ConnectTimeoutMs, SendTimeoutMs, ReceiveTimeoutMs

XMLServer.setRequestHeader "User-Agent", "My XML App V1.0"
XMLServer.setRequestHeader "Content-type", "text/xml"
XMLServer.Open "POST", Server_Address, False
XMLServer.send (My_XML_Request_String_or_XML_Document)
Failure = (XMLServer.Status <> 200)
If Not Failure Then XMLReceive.loadXML (XMLServer.ResponseXML.XML)

to:

Set XMLServer = CreateObject("WinHttp.WinHttpRequest.5.1")
Set XMLReceive = CreateObject("Msxml2.DOMDocument.6.0")
XMLServer.setTimeouts ResolveTimeoutMs, ConnectTimeoutMs, SendTimeoutMs, ReceiveTimeoutMs

'force TLS 1.2
XMLServer.Option(9) = 2048
XMLServer.Option(6) = True

XMLServer.Open "POST", Server_Address, False
XMLServer.setRequestHeader "User-Agent", "My XML App V1.0"
XMLServer.setRequestHeader "Content-type", "text/xml"
XMLServer.send (My_XML_Request_String_or_XML_Document)
Failure = (XMLServer.Status <> 200)
If Not Failure Then XMLReceive.loadXML (XMLServer.ResponseText)

Good luck!

ASP MDB x64 issue

ADODB.Connection error '800a0e7a'
Kan de voorziening niet vinden. Mogelijk is deze niet juist geïnstalleerd.
/someaspfile.asp, line 123

Okay; moved to a new server… Windows 2016 Standard, 64 bit
So now what? Well, you could read here.

ASP Error: ADODB.Connection error ‘800a0e7a’ Provider cannot be found. It may not be properly installed.
Without naming a source the answer is: “Never mind.  I found the answer on another forum.  “Enable 32-bit applications” needs to be enabled in the connection pool for the website, within IIS Manager 7.”

But how? Well, just:

  • Start Internet Information Services (IIS) Manager
  • Go to your application pools
  • Click on “DefaultAppPool”
  • Click on “Advanced Settings”
  • In General, set “Enable 32-bit Applications” to true

That’s all folks!
Contact My Brain if you need any help!

MySQL user not connecting

Problem:
Windows Server 2016, IIS Website, Setup a MySQL server/database, setup a WordPress website, quickly connect with root and root-password. Everything works fine!

Now you want things more secured, so you add a MySQL user with a password and rights to only the wordpress database. Change wp-config.php with the new login and you get a “Error Establishing a Database Connection” when accessing the WordPress website or admin.

Change back to root and the problem is solved. How to fix this?

Continue reading MySQL user not connecting

PHP mail on IIS Windows 2016 Server

How?

IIS MANAGER
Configure SMTP E-mail here to send using an external mailserver will work for ASP scripts – Deliver to SMTP server with credentials

IIS 6.0 MANAGER
Configure the SMTP server here to make the PHP mail-function work.
Properties:
Access-Connection – Grant only your own server IP and 127.0.0.1
Access-Relay – Grant only your own server IP and 127.0.0.1
Delivery-outbound security – Basic Auth login details TLS
Delivery-Advanced – Smart Host smtp server name

PHP.INI
SMTP = 127.0.0.1
smtp_port = 25

SERVICES
configure SMTPSVC to start automatic, so you won’t go crazy after your next reboot…