Couldn't find Microsoft Word Document in DCOM Config - c#

I am creating a simple asp.net web site that use office 2007/2010 automation .. when i published the website on the iis 7 on my local machine (window 7) have an exception
Retrieving the COM class factory for component with CLSID
{000209FF-0000-0000-C000-000000000046} failed due to the following error:
80080005 Server execution failed (Exception from HRESULT: 0x80080005
(CO_E_SERVER_EXEC_FAILURE)).
I have searched for this exception and i found that i have to set some permissions to office in DCOM Config.
I have opened the component services and opened DCOM Config, but i have not found Microsoft Word Document i have found only office word 97 - 2003.
can any one tell me how to solve this problem.

Found the answer here: DCOM Failure of Office Automation
If you are running a 64-bit server with 32-bit Office, you may have trouble finding this DCOM setting. You will need to run "MMC -32" from the command prompt to launch 32-bit MMC and then add 'Component Services' from the 'File > Add / Remove Snap-ins' menu.

Yes, office word 97 - 2003 is a right name of DCOM document (resp. application) Word 2007 or 2010. Don't ask me why...
Where could be the trouble?
The user must have access to desktop. If Word is called from ASP.NET, it has probably not this access. So set in dcomcnfg.exe an account explicitly. Don't use The launching user (it is a IIS identity, it hasn't its own desktop) and don't use The interactive user (it works only if some user is logged in).
In my solution I have set:
I have created new user (in user group), called WordUser
I have created in IIS new application pool with WordUser permission; Load User Profile must be true
DCOM I have set to use WordUser, on Security tab I've added WordUser wit Launch and activation Permission and Access Permission
Maybe another way is possible, but this should work.

Related

Outlook VSTO Add-in not visible in Outlook

I have an Outlook Add-in(under development) which was working fine on my old system. I decided to migrate to a new system(for better performance), when I have done so(IN DEBUG MODE), I saw that after some time the Add-in is not visible in Outlook(neither in COM AND disabled window).
Specifications I am using:
System type is 64-bit OS, x64-based processor
Microsoft Visual Studio Community 2019 Version 16.5 with .NET framework 4.7.2
Microsoft Office 365(16.012730.20144) 32-bit
Troubleshoots I tried:
1) Checked Build Office solutions, for verifying all items are generating and working properly.
Registry entry is generating correctly.
VSTO file(bin/debug) is getting installed successfully(when I manually double click that)
2) Troubleshooting by Event Viewer:
No error's related to Outlook(as a source).
Possibly related error's:
i) Source - DistributedCOM : The application-specific permission settings do not grant Local Activation permission for the COM Server application with CLSID
{6B3B8D23-FA8D-40B9-8DBD-B950333E2C52}
and APPID
{4839DDB7-58C2-48F5-8283-E1D1807D0D7D}
to the user NT AUTHORITY\LOCAL SERVICE SID (S-1-5-19) from address LocalHost (Using LRPC) running in the application container Unavailable SID (Unavailable). This security permission can be modified using the Component Services administrative tool.
ii) Other Errors are from source PerfNet and NDIS(Which I suppose is not related to this topic)
3) Troubleshooting by Process Explorer:
Their is no outlook Add-in DLL present in process explorer.
4) Troubleshooting by Process Monitor:
I am new with procmon, so just used some basics like, applied a filter with Outlook process name(including registry, file system, Network, process and thread activities).
And the results were SUCCESS, BUFFER TOO SMALL, NAME NOT FOUND, NO MORE ENTERIES other. Their was nothing I can relate with my issue.
Other Information
After this issue, I made a same new project and it worked fine, but the same happened(Add-in not visible) after some time. And I have done this(Created new project) four times till now. What I observed is, when I create a new Add-in with same name, the issue is same, so I have to choose different name every-time.
I am not able to find any error description for this. So can anybody please tell me what is the issue here OR how I can troubleshoot more(with above tools or new one).
Thanks in advance.
If you don't see your add-in listed in the COM add-ins dialog of Office applications, the problem is related to Windows registry keys required. Read more about them in the Registry entries for VSTO Add-ins article.
It seems something is wrong with your add-in registry entries (maybe permissions). And the issue can be related to Windows/Office bitness. Most probably you had another Office edition (bitness) installed on the old system (or Windows).

Accessing MS-Word object model via asp.net throw error: 80080005 Server execution failed(Exception from HRESULT: 0x80080005(CO_E_SERVER_EXEC_FAILURE))

i have developed a website that allows users convert existing word file to PDF and download it, included references to Office.interop.word, and the site works fine on my development machine. When I uploaded it to my production server the functions not working in the server, In the server also installed MS-word.
even i tried below methods
In the command line put DCOMCNFG
Component Services -> Computers -> My Computer -> DCOM Config
Find "Microsoft Word 97 - 2003 Document" (If it is missing check if your Word is also 64 bit (if your Windows is))
Right click -> Properties
Go To Tab Security and Edit the "Customize" radio buttons so that IIS_IUSRS could have rights for launch and access
Go to Tab Identity and choose "The interactive user"
all this fails then i have tried to tab "General" and in "Authentication Level" drop down choose "None".
still the error continue...
Error : "Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error:
80080005 Server execution failed (Exception from HRESULT: 0x80080005 (CO_E_SERVER_EXEC_FAILURE))."
Can any one help me?
You have reached a dead end. Running Office programs inside an ASP.NET webserver is not supported:
Microsoft does not currently recommend, and does not support, Automation of Microsoft Office applications from any unattended, non-interactive client application or component (including ASP, ASP.NET, DCOM, and NT Services), because Office may exhibit unstable behavior and/or deadlock when Office is run in this environment.
I would suggest to find other ways to do what you want. There are a lot of libraries capable of reading and writing Office documents without using Office itself.

Unit Test fail with HRESULT: 0x80070005 (E_ACCESSDENIED) on TFS

I have an Outlook Add in where I am using Microsoft.Office.Interop.Outlook.Storageitem to save my settings.
Most of my tests access the settings to set or get the configuration for contacting the server.
On my local machine all of the tests are running fine. But when I check in my project into TFS and run the tests there all of them fail with the Error:
System.UnauthorizedAccessException: 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)).
The error occurs when the test is calling the following codeline.
Folder inbox = (Folder) new Microsoft.Office.Interop.Outlook.Application().GetNamespace("MAPI").GetDefaultFolder(OlDefaultFolders.olFolderInbox);
I asume that the error appears because the test tries to access an Application of Outlook and does not have the permission.
Outlook is instaled on the Windows Server 2012 where TFS is running.
Also Outlook was started once with having no Mailaccount configured. (The test runs fine when i start it manually on a machine with a Outlook with no Mailaccount configured.)
The C:\Windows\SysWOW64\config\systemprofile\Desktop folder exists.
I already have set all permissions for the user NETWORK SERVICE in Controlpanel->Administrative tools->Component Services->computers-> myComputer->DCOM Config->Microsoft Outlook
I also found this question which has no answer to my problem.
Are there any other steps i could try to give my tests access to run the tests sucessfully?
Outlook is instaled on the Windows Server 2012 where TFS is running.
I already have set all permissions for the user NETWORK SERVICE in Controlpanel->Administrative tools->Component Services->computers-> myComputer->DCOM Config->Microsoft Outlook
Microsoft does not currently recommend, and does not support, Automation of Microsoft Office applications from any unattended, non-interactive client application or component (including ASP, ASP.NET, DCOM, and NT Services), because Office may exhibit unstable behavior and/or deadlock when Office is run in this environment.
If you are building a solution that runs in a server-side context, you should try to use components that have been made safe for unattended execution. Or, you should try to find alternatives that allow at least part of the code to run client-side. If you use an Office application from a server-side solution, the application will lack many of the necessary capabilities to run successfully. Additionally, you will be taking risks with the stability of your overall solution. Read more about that in the Considerations for server-side Automation of Office article.
No Office app (Outlook included) can be used in a service. I don't think actually creating an instance of Outlook.Application is a good idea in a unit test.
Try changing the TFS build server to run as a user with admin rights on the box. I would not suggest leaving this configuration.

Install or Configure Interop.Microsoft.Office.Interop.Word.dll

Situation: I have web application in my pc, who manipulates docs to generate pdfs with no problem. I configured my dcomcnfg to work fine because I had the problem with access permissions the COM.
The problem: I have to put the website in the server. The server has Win8 Enterprise. Doesn't have Visual Studio installed, only framework 4.0 and the Word Office. When I try to generate pdf it always return this error: Retrieving the COM class factory for component with CLSID ...
I run dcomcnfg and customized all permissions to IIS service (doesn't work and put to) Everyone. I Set all Launch and Activation permissions to allow Everyone, I also set Access Permissions and configuration permissions.. And still don't work.
I have to register the dll in server?(How I do it?)
I need more configurations?
I Have to install all Office?
ps: Office 2013
while it is not recommended to use this on server, there is a possible solution:
impersonate the admin in the asp.net application:
http://msdn.microsoft.com/en-us/library/aa292118%28v=vs.71%29.aspx
it may have security issue.

Issues with class factory for component with CLSID {00024500-0000-0000-C000-000000000046}

I am exporting data to Word file using some interops dll's. earlier I have developed the applicaion in Windows 2008 Server, at that time I could able to export the data to Word file. but recently I have upgraded my pc to Windows 7. It is working fine in my localhost.
When i deploy the application in IIS I am getting this error:
Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80070005.
I had problems with the interop lib in a Windows Server 2003. I was trying to create a excel file through the .NET application. It worked in local but in the server.
This links explain how to solve the problem.
First at all you have to install M.O.Excel at the Server.
Configure in DCOM the Microsoft Excel application.
http://blog.crowe.co.nz/archive/2006/03/02/589.aspx
It saved me!!
Take a look at ASP.NET and Access Error 80070005:
a. I first opened DCOMCNFG from the command prompt, opened Component Services, expanded Computers/My Computer/DCOM Config. Then I Selected Microsoft Excel Application, and in the resulting dialog selected Security tab. Under Security Tab I changed Launch and Activation Permissions to customize, Access Permissions to customize and configuration Permissions to customize. And in the all the three I selected the ASPNET account.
b. I then Select the NEW Folder in Windows Explorer, opened the properties and under WebSharing tab I selected Share This Folder.
OR Error : 80070005:
The .DLL in the bin folder is just a COM interop assembly. The actual COM component must also be installed on the Web Server, so you should check that.
OR When creating word object error : Access is denied: 80070005 :
You can gain access to the Office components only throught manually created account, that has access to the office binary files. For example your own account.
Fixing the security settings of Microsoft Excel Application in DCOM Config:
Control Panel > Administrative Tools > Component Services > Computers > My Computer > DCOM Config > Microsoft Excel Application
Right click to get properties dialog. Go to Security tab and customize
permissions accordingly.
Source: https://social.msdn.microsoft.com/Forums/en-US/b6388275-b295-4e55-8c25-6d8788eac1ca/error-while-creating-excel-object

Categories

Resources