IIS - Pls give answer - Asked By Aravind Aravind on 23-Jul-12 11:29 PM

Retrieving the COM class factory for component with CLSID {0006F03A-0000-0000-C000-000000000046} failed due to the following error: 80070005 Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))


if i call outlook application it show the above error what i do
Robbe Morris replied to Aravind Aravind on 23-Jul-12 11:45 PM
Did you have Outlook running while attempting to use the COM object?  I'll take a wild guess and say the object you want to interact with requires Outlook to be open and running.
Aravind Aravind replied to Robbe Morris on 24-Jul-12 03:14 AM
Hello sir  thanx for ur reply
    If i run that program from file system(i.e. if i save that project in local drive like D,E,F it works well).But if i save in the
iis 7 it show the error like

Retrieving the COM class factory for component with CLSID {0006F03A-0000-0000-C000-000000000046} failed due to the following error: 80070005 Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)

My project code is
Place one button.In button click event u call the function SendMailOUTLOOK()
Private Sub SendMailOUTLOOK()
      Dim a As String
      a = "E:\Aravind\fiup\fiup\Image\Koala.jpg"
      Dim objOutlk As New Microsoft.Office.Interop.Outlook.Application 'Outlook
      Const olMailItem As Integer = 0
      Dim objMail As New System.Object

      ' Start Outlook.
      ' If it is already running, you'll use the same instance...
      Dim olApp As Microsoft.Office.Interop.Outlook.Application----------->>>>Error Show
      olApp = CreateObject("Outlook.Application")

      objMail = objOutlk.CreateItem(olMailItem) 'Email item

      ' Logon. Doesn't hurt if you are already running and logged on...
      Dim olNs As Microsoft.Office.Interop.Outlook.NameSpace
      olNs = olApp.GetNamespace("MAPI")
      olNs.Logon()



      'Insert your "To" address...it can by dynamically populated
      objMail.To = "panchaksharamba@gmail.com"

      'Insert your "CC" address...it can by dynamically populated
      objMail.cc = "panchaksharamba@gmail.com" 'Enter an address here To include a carbon copy; bcc is For blind carbon copy's

      'Set up Subject Line
      objMail.subject = "testing web-based email message"

      'To add an attachment, use:
      objMail.attachments.add(a)
      ''otherwise, if no attachment, you can comment the objMail.attachments.add("") out with an apostrophe

      'Set up your message body
      Dim msg As String

      msg = ""
      objMail.body = msg
      'Use this To display before sending, otherwise call (use) objMail.Send to send without reviewing
      objMail.display()

      'Clean up
      objMail = Nothing
      objOutlk = Nothing
    End Sub



pls reply me just u add reference in the project outlook library
add namespace
 Imports System.Reflection
Imports Outlook = Microsoft.Office.Interop.Outlook
Imports Microsoft.Office.Interop
Imports System.Web.Mail
'Imports System.Net.Mail

Robbe Morris replied to Aravind Aravind on 24-Jul-12 07:40 AM
It is not safe to use Outlook in IIS.  Why are you not just sending mail with System.Web.Mail instead?
Aravind Aravind replied to Robbe Morris on 25-Jul-12 02:03 AM
ok sir i here i give simple code

System.Diagnostics.Process.Start("calc")

just place one button in vb.net ,in  button click event u past above code and run the program from local drive (it works well) if past the program in IIS it doesn't work. This code is simply call the calculator.

pls reply me urgent
Robbe Morris replied to Aravind Aravind on 25-Jul-12 07:15 AM
I repeat....  It is not safe to use Outlook in a .NET app running in IIS.  Outlook is not designed for multi-user environments like this.  You need to use the .NET functionality for sending email.
Aravind Aravind replied to Robbe Morris on 25-Jul-12 11:51 PM
simple code to check in IIS
 
System.Diagnostics.Process.Start("calc")

    just paste this code in click event and run.in local drive u get calculator but u run from IIS it doesn't open calculator but if u see in task manger u see calc.exe is run in the process.
Here i am not ask client side or server side.Just past  the program in IIS(C:\inetpub\wwwroot) and in run command type iis and open in that select ur program from default web site and right click and select convert to application.open visual studio and choose that program if u run u didnt get claculator but its process run in  the taskmanger.