Cannot Create ActiveX Component

Hi,

I am having problems to send email notification via my VB.NET program. When I run the program from web browser and trigger an email notification, I received the following error:


Event Type: Warning

Event Source: ASP.NET 2.0.50727.0

Event Category: Web Event

Event ID: 1309

Date: 18-Mar-07

Time: 10:38:34 PM

User: N/A

Computer: TEKLANG5

Description:

Event code: 3005

Event message: An unhandled exception has occurred.

Event time: 3/18/2007 10:38:34 PM

Event time (UTC): 3/18/2007 2:38:34 PM

Event ID: 1b677f9c8e104aacba3f9d8a80f18bd1

Event sequence: 4

Event occurrence: 1

Event detail code: 0

Application information:

Application domain: /LM/W3SVC/1/Root/OITRS-1-128187022970781250 

Trust level: Full 

Application Virtual Path: /OITRS 

Application Path: C:\OITRS\ 

Machine name: TEKLANG5 

Process information:

Process ID: 3512 

Process name: w3wp.exe 

Account name: NT AUTHORITY\NETWORK SERVICE 

Exception information:

Exception type: Exception 

Exception message: Cannot create ActiveX component. 

Request information:

Request URL: http://teklang1/OITRS/tfsmdms1_test.aspx 

Request path: /OITRS/tfsmdms1_test.aspx 

User host address: 192.168.3.132 

User:  

Is authenticated: False 

Authentication Type:  

Thread account name: NT AUTHORITY\NETWORK SERVICE 

Thread information:

Thread ID: 1 

Thread account name: NT AUTHORITY\NETWORK SERVICE 

Is impersonating: False 

Stack trace:    at Microsoft.VisualBasic.Interaction.CreateObject(String ProgId, String ServerName)

at TFSMDMS1_Test.SendNotification() in C:\OITRS\TFSMDMS1_Test.aspx.vb:line 36

at TFSMDMS1_Test.Button1_Click(Object sender, EventArgs e) in C:\OITRS\TFSMDMS1_Test.aspx.vb:line 90

at System.Web.UI.WebControls.Button.OnClick(EventArgs e)

at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)

at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)

at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)

at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)

at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

Custom event details:

For more information, see Help and Support Center at Microsoft Support.


However, after I refresh the page again, and repeat the above step, I received another error message as below:


Retrieving the COM class factory for component with CLSID {29131539-2EED-1069-BF5D-00DD011186B7} failed due to the following error: 8007000e.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.OutOfMemoryException: Retrieving the COM class factory for component with CLSID {29131539-2EED-1069-BF5D-00DD011186B7} failed due to the following error: 8007000e.

Source Error:

Line 34:

Line 35: 'Start a session to notes

Line 36: Session = CreateObject(“Lotus.NotesSession”)

Line 37: 'This line prompts for password of current ID noted in Notes.INI

Line 38: 'Call Session.Initialize()

Source File: C:\OITRS\TFSMDMS1_Test.aspx.vb Line: 36

Stack Trace:

[OutOfMemoryException: Retrieving the COM class factory for component with CLSID {29131539-2EED-1069-BF5D-00DD011186B7} failed due to the following error: 8007000e.]

Microsoft.VisualBasic.Interaction.CreateObject(String ProgId, String ServerName) +176

TFSMDMS1_Test.SendNotification() in C:\OITRS\TFSMDMS1_Test.aspx.vb:36

TFSMDMS1_Test.Button1_Click(Object sender, EventArgs e) in C:\OITRS\TFSMDMS1_Test.aspx.vb:90

System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105

System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +107

System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7

System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11

System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33

System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102


I have search through the Internet and followed/performed all the following steps but still having the same result"

  1. Unregister and Re-register nlsxbe.dll

  2. Grant “Read” access to Everyone to the “C:\Program Files\Lotus\Notes” folder

  3. Added a virtual “Domino” directory to IIS Server

  4. Check in Registry, CLSID {29131539-2EED-1069-BF5D-00DD011186B7} is pointing the “C:\Program Files\Lotus\Notes\nlsxbe.dll” - Assuming is correct

  5. Add COM Reference in program (Lotus Domino Objects and Lotus Notes Automation Classes)

Below is my coding:


'Imports Microsoft.VisualBasic

'Imports Microsoft.VisualBasic.FileIO.FileSystem

'Imports System.IO

'Imports System.Net.Mail

'Imports System.Web.Mail

'Imports Domino

'Imports lotus

'Imports System.Data

'Imports System.Data.OleDb

Partial Class TFSMDMS1_Test

Inherits System.Web.UI.Page



Public Sub SendNotification()

    Dim MailClient As New System.Net.Mail.SmtpClient

    Dim MsgToRequester As New System.Net.Mail.MailMessage

    Dim MsgToHelpdesk As New System.Net.Mail.MailMessage





    Dim Maildb As Object

    Dim MailDoc As Object

    Dim Body As Object

    Dim Session As Object

    'Dim strBody As String



    'Start a session to notes

    Session = CreateObject("Lotus.NotesSession")

    'This line prompts for password of current ID noted in Notes.INI

    'Call Session.Initialize()

    'or use below to supply password of the current ID

    'Call Session.Initialize("<password>")

    Call Session.Initialize("sBee5564")

    'Open the mail database in notes



    Maildb = Session.GETDATABASE("TFSMDMS1", "mail\slim.nsf")



    If Not Maildb.IsOpen = True Then

        Call Maildb.Open()

    End If

    'Create the mail document

    MailDoc = Maildb.CREATEDOCUMENT

    Call MailDoc.ReplaceItemValue("Form", "Memo")

    'Set the recipient

    Dim Recipients(1) As String



    Recipients(0) = "Seok Bee Lim"



    Call MailDoc.ReplaceItemValue("SendTo", Recipients)

    Call MailDoc.ReplaceItemValue("Subject", "Testing")

    'Create and set the Body content

    Body = MailDoc.CREATERICHTEXTITEM("Body")

    'strBody = HttpUtility.HtmlEncode(TextBox1.Text)

    Call Body.APPENDTEXT(TextBox1.Text)

    'Example to create an attachment (optional)

    Call Body.ADDNEWLINE(2)

    'Call Body.EMBEDOBJECT(1454, "", "C:\Documents and Settings\seokbee\My Documents\Documents\Lotus Notes\ID listing.xls", "Attachment")

    'Example to save the message (optional)

    MailDoc.SAVEMESSAGEONSEND = True

    'Send the document

    'Gets the mail to appear in the Sent items folder

    Call MailDoc.ReplaceItemValue("PostedDate", Now())

    Call MailDoc.SEND(False)

    'Clean Up

    Maildb = Nothing

    MailDoc = Nothing

    Body = Nothing

    Session = Nothing

    TextBox1.Text = "Sent Successful"

End Sub



Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click

    SendNotification()

End Sub

End Class


I am using Visual Studio 2005 (VB.NET), IIS 6.0 and Lotus Notes Client 6.5.5 installed.

The IIS Server is running on Windows 2003 Server. When I debug from development, the program work as expected.

Does anyone have any solution to this problem?

I need to solution urgently as my company already migrated to Lotus Notes and all my programs needs to be updated and send the email notification via Lotus Notes.

Many thanks in advance.