Share via


Troubleshootign IIS: Site Move: Server.CreateObject Failed

 


Background

One of my team member moved the IIS site from Windows Server 2000 to Windows 2008 R2 and got the error message below.

Error

Error at line 165 Server.CreateObject Failed

Code

Set CDONTSObj = Server.CreateObject(``"CDONTS.NewMail"``)  


Case History

In our production environment this site works fine, but after moving the site to new environment this fails. Case document has no clear information. What to do ? Goolge, Bing? Can we scrub our Event Viewer? Choose anything you want but before that we should know how the site was moved. Did you moved and registered the required DLL's? Nope, why should we do when rest of the sites are working fine? Yes, this is what most of the Admins will conclude. Before deciding we should think about the functionality of the site/Application. All other working applications doesn't use SMTP but this is consuming the SMTP service to trigger emails.

 

 


How to Fix

Assuming your application is running in 32 bit. Delegate appropriate access to all users in Access MDB file. So that it will make an entry for Order placement and retrun. Confirmed that entry found in access file. Okay we are progressing positively. Try to send email by clicking send button and scrubbed event viewer. No dice, no error found. But application gave the same error message.

Application Code

Set CDONTSObj = Server.CreateObject("CDONTS.NewMail") 
 CDONTSObj.To = strUserEmail 
 CDONTSObj.CC = strRequesterEmail 
 CDONTSObj.MailFormat = 0 
 CDONTSObj.BodyFormat = 0 
 CDONTSObj.From = "ICT Services" 
 CDONTSObj.Subject = "Random-" + cStr(intReference) 
 CDONTSObj.Body = strEmail1 
 CDONTSObj.Send 
 Set CDONTSObj = nothing

Clue

Set CDONTSObj = Server.CreateObject("CDONTS.NewMail") This is failing to create an object and throws an exception.

 

What is CDONTS?

CDONTS: Colloboration Data Objects for Windows NT server over SMTP.

Reference Link: CDONTS

 

Now a quick call to fix this? Shall we change the code ? or Shall we register the DLL?

 

 


Solution

Register CDONTS DLL is easy, but a time consuming fix.

 

 

How to Register DLL?

  1. Step 1: Copy CDONTS DLL from your server or download new DLL
  2. Step 2: Open Command Prompt as Administrator.
  3. Step 3: Navigate to path C:\Windows\System32\regsvr32.exe D:\CDONTS\CDONTS.DLL
  4. Step 4: Close all your Browser and reset IIS (Optional)

Note: D:\CDONTS is the path where I moved my DLL you can change as required.