2

from last so many times I am getting the below error.As I am using the Microsoft Word dlls to create word files which further attached to the mail.

Server Error in '/' Application.
Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 8000401a.
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.Runtime.InteropServices.COMException: Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 8000401a.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[COMException (0x8000401a): Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 8000401a.]
   iPortal.user.sendRAMail.GetData(Object fileName) in XXX:512
   iPortal.user.sendRAMail.btnSend_Click(Object sender, EventArgs e) in XXX:1300
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +107
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +110
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3436


Version Information: Microsoft .NET Framework Version:2.0.50727.4216; ASP.NET Version:2.0.50727.4223 

can anybody please suggest me any solution.As I am also got some solutions that say me to change the access permission for the Word dlls using the DCOMCNFG but still getting the same error.but on some time it works properly...so I think the code is not an issue. And also how I will find which account is using my current application.(ex.Network Service, Administrator etc)

gorkem
  • 731
  • 1
  • 10
  • 17
gofor.net
  • 4,218
  • 10
  • 43
  • 65
  • 0x8000401a = CO_E_RUNAS_LOGON_FAILURE, though it sounds like you might already know that? Is there anything obvious in the security event log? – Rup Apr 13 '12 at 11:25
  • 1
    Hi @Rup thanks for reply,i checked the Security Log but no error mentioned there.But Application log have the same warning.Which showing the `Retrieving the COM class factory for component with CLSID` error – gofor.net Apr 13 '12 at 11:56

4 Answers4

6

I found the solution,

using DCOMCNFG.exe open it and go to Component Service ->Computers->My Computer->DCOM Config-> check for Microsoft Office Word option and select tab Security.Here you will get the options for Launch and Activation Permission->select Customize and click on edit and the add the user that will runs your Application with full access.

That's all ,this resolve my problem hop this will help.

gofor.net
  • 4,218
  • 10
  • 43
  • 65
  • Thanks, worked for me. For those using OpenOffice, check for the OpenOffice option under DCOM Config instead. – Jason Jul 03 '14 at 06:00
1

My idea would be to get rid of Com all together if I can find a better solution I would use it

Check this out

http://docx.codeplex.com/

Micah Armantrout
  • 6,781
  • 4
  • 40
  • 66
  • I don't agree with the sentiment in general but from inside ASP.NET you should definitely avoid automating Word, yes. – Rup Apr 13 '12 at 16:44
0

One thing I did on my server was to open Microsoft Word on the machine and this seemed to cause the error to go away.

dellyjm
  • 426
  • 1
  • 5
  • 10
0

you can create another user , then login with that and create remote to 121.0.0.1 and main user (loopback to rpc!!!) then diconnect from new user and you will have interactive user