Word Interop from MVC Web Application - c#

I am new to C# & MVC but have written a simple web application which updates a users Outlook Email Signature.
This application works in my test environment but when I deploy I receive errors around the Word Interop assembly I'm using.
I have seen blogs which discuss why you don't want to install and use server side Office applications. How can I use the office installation on the executing user's computer?
It is safe to assume that all users navigating to this application will have office installed on their machine.
How can I create a word file locally on their machine from an MVC Web app which is a simple form? Is my only option OpenOffice XML?
I'm sorry if this question isn't well structured, I'm struggling to understand the concept myself

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.
As a workaround you may consider using any third-party components designed for the server-side execution or just Open XML SDK, see Welcome to the Open XML SDK 2.5 for Office for more information.

Related

Issue in opening a word document(.doc- Microsoft word 97- 2003 document) which is trying to connect with some network drive while opening

We are trying to convert a .doc file to .docx using c# code. Now, while opening the MS word application, the .doc file is taking more than 20 mins to open as it trying to connect to some network path to find some template.
Is there any way we can open that .doc file without letting it connect with network drive using Microsoft technologies.enter image description here
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.
Instead, you may consider using any third-party components designed for the server-side execution. The Open XML SDK can be considered if you deal with open XML documents only, see Welcome to the Open XML SDK 2.5 for Office for more information.

Excel interop error- while running from windows service. Microsoft excel cannot open or save any more doc

Hi I have created windows service c# to create an excel file. When I scheduled and running under my id in dev environment it is working fine. But when i run the same service with different interactive Id which is also an administrator account in the server, the service is failing at the line Excel.WORKBOOK.saveas(object) with the below error
"Microsoft Excel cannot open or save any more documents because there is not enough available memory or disk space." I have tried many solutions provided in net to provide permissions in comconfig and to create desktop folders in c:\windows\sys32 and syswow64.
But still unable to find it.. only with my id the service is running fine but any other interactive if it is failing. Please help
The Considerations for server-side Automation of Office article states the following:
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.
I'd suggest using the Welcome to the Open XML SDK 2.5 for Office if you deal only with open XML documents, otherwise you may consider using third-party components designed for the server-side execution.

C# Outlook Retrieving the COM class factory for component with CLSID failed due to the following error: 80080005

I am getting the below error when I try to access Outlook folder to download an attachment from my inbox.
My code working perfectly when I run from Windows Form application. But when I use Windows Service to auto scan the Outlook folder, I am getting this issue.
*PollingService encountered an error 'Retrieving the COM class factory for component with CLSID {0006F03A-0000-0000-C000-000000000046} failed due to the following error: 80080005.'
For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.*
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.
As a workaround you may consider using a low-level API on which Outlook is built - Extended MAPI or any other third-party wrapper around that API (such as Redemption).

System.Runtime.InteropServices.COMException (0x800A1436)

We are trying to open a Word template which resides on a Shared Drive using Office Interop Services on an MVC application.The solution is working locally, but once is deployed to the server the following message appears:
The File was not created: System.Runtime.InteropServices.COMException (0x800A1436): This file could not be found
ApplicationPool is running under a domain user account which already has permissions on the shared drive.
Any suggestion?
You may consider using the Open XML SDK for dealing with open XML documents (.docx), see Welcome to the Open XML SDK 2.5 for Office. Or any other third-party components designed for the server-sider execution (for example, Aspose).
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.
Kb257757 https://support.microsoft.com/en-us/help/257757/considerations-for-server-side-automation-of-office
Server-side automation of office is not supported using Interop, try using an XML based approach such as ClosedXML which is available from NuGet.

How to fix the COM issue in asp.net?

I have a problem when converting the word to pdf using Microsoft Interop COM object.I am getting when the applciation is hosted in local IIS.
I have googled alot but no use can any one help me on this ?
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.
You can read more about that in the Considerations for server-side Automation of Office article.

Categories

Resources