uploading excel file in c# .net web application result in error - c#

my .net web application has a option of uploading a excel file, which has around 1k entries of products, the upload works fine when i run the application on localhost, but results in the following error when it is hosted on iis7 & accessed by some other computer on the network..
error
Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80070005 Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).
Exception Details: System.UnauthorizedAccessException: Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80070005 Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).
I googld it, and found some talking about 32-bit or 64-bit OS.
Thanks.

You should avoid using Excel Interop in a server application for the reasons described in this KB article.
Instead, consider using a third-party product to manipulate the Excel document, such as EPPlus (Excel 2007+), Aspose Cells, SpreadsheetGear.
Probably your ASP.NET app is running under an account that doesn't have a profile.

Ensure the upload folder is given full permission so as to upload from other computers. First start by giving permission to EVERYONE. Then you may restrict it to IIS user only.

Sounds to me that when your implementing your application on the server, something isn't getting installed that your using on your development machine. Whatever your using to upload, if it is a third party upload control or something, you might not be distributing that file.
Another possibility is, that the server your installing your application on is a 64 bit machine, and the upload control your using is built for 32 bit only. You might want to set the server to 32 bit for IIS 7.
http://www.depotsystems.com/ds_mobile_webhelp/webhelp/index.htm#page=Enabling_32_bit_mode.htm

Related

Zkemkeeper.dll not working after deploying, Class not registered?

I am trying to integrate to ZKTeco bio-metric device with my web application. It's working absolutely fine but when I deploy application and try to connect with bio-metric device I get the following error:
Retrieving the COM class factory for component with CLSID {00853A19-BD51-419B-9269-2DABE57EB61F} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).
I am following this tutorial.
I tried following solutions:
I changed the reference of my dll to copy to local.
I changed the targeted CPU before deploying.
But both the solutions didn't work. What could be possible solution?
You must register zkemkeeper in every computer that will use your program, not just in the development environment.
To register the zkemkeeper dll in both development and deployment computers, follow the steps provided in the solution of this post: Error when inserting finger print data into database table. When registering in deployment computers, avoid the steps related with the Visual Studio.
You should also take a look to this document, it provides useful information to understand how zkemkeeper works: COM Class Objects and CLSIDs.
Best regards.

MSProject COM Interop unstable behavior

We are extensively using COM Interop with MSOffice applications, and one of them - MSProject 2013, is behaving very unstable and strange.
Sometimes it starts just fine, and works fine, but from time to time it is bugging us with following error:
Retrieving the COM class factory for component with CLSID
{36D27C48-A1E8-11D3-BA55-00C04F72F325} failed due to the following
error: 80080005 Server execution failed (Exception from HRESULT:
0x80080005 (CO_E_SERVER_EXEC_FAILURE)).
This can happen at any time, does not matter if windows was rebooted a few seconds ago, or uptime is several hours and MSProject was opened and closed several times.
What can we do to solve, or at least diagnose root cause of such a behavior?
this is a generic the best answer
Using DCOMCNFG.exe. Open it and go to: Component Services -> Computers -> My Computer -> DCOM Config -> Microsoft Excel Application.
Open the properties, select Identity tab and select the interactive user.
come from this link Server execution failed (Exception from HRESULT: 0x80080005 (CO_E_SERVER_EXEC_FAILURE))
but the actual error caused a memory issue which leaded to the exception from hresult 0x80080005 error.
check if maybe open file and didn't close it after reading msProject check the behavior of the code.
Also i recommend to change COM and read MsProject from XML to be faster and more clear than interop

Retrieving the COM class factory for component with CLSID {...} failed due to the following error: 80070005 Access is denied

I'm using https://www.npmjs.com/package/node-msoffice-pdf to convert a word to a pdf. This solution works perfectly on my computer.
I updated my app in IIS and I get this error when calling the web service that converts the docx to pdf:
Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 80070005 Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).
I have tried several answers and tutorials step by step such as:
Accessing Office Word object model through asp.net results in "failed due to the following error: 80070005 Access is denied."
Retrieving the COM class factory for component with CLSID failed due to the following error: 80070005 Access is denied
https://jayeshsidhwani.wordpress.com/tag/hresult-0x80070005-e_accessdenied/
https://waheedrous.wordpress.com/2014/01/26/error-office-interop-assemblies
But I got to nowhere.
I also tried to run my app in the server but as localhost and it worked perfectly, zero problems.
I noticed that the CLSID in the error message it isn't the same as the Microsoft Word 97 - 2003 Document Component Service App ID.
The only tutorial that got me somewhere is this one http://toastergremlin.com/?p=543. The error was gone but the Word wasn't being opened and the web service just got stuck.
In the Microsoft Word 97 - 2003 Document Component Service I tried to add the following users: NETWORK_SERVICE, IIS_IUSRS, PC\Users and the apppool associated with my website.
I had similar issue when trying to create my own Interop DLL thru IIS web. And after lot of searches, this post solved my life

Azure web app issue: System.Runtime.InteropServices.COMException 80040154 Class not registered

I am successfully hosting my quickbooks webconnector soap app on a private server. We are attempting to move it to an Azure api app.
When we attempt to run it, we are getting the error:
Error message: System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.Runtime.InteropServices.COMException:
Retrieving the COM class factory for component with CLSID {22E885D7-FB0B-49E3-B905-CCA6BD526B52} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).
From remembering this issue when we originally deployed and from this intuit post, I recall we have to make sure that our project build has a target platform of x86. We have done that. And when we use CorFlags to validate it is set to require 32bit, we can confirm that from the CorFlags output.
In the Azure portal, we have the app settings set to 32 bit as well.
What else could we be missing?
As has been mentioned elsewhere: You cannot register COM objects in an App Service (Web App, API App). You'd need to work with something else that allows this (e.g. web/worker roles, Virtual Machines).

unable to access com component for OneNote via windows service

I have a console application which extracts text from images using Onenote com,when i run this application by myself it works fine but if i try to run it using windows service it gives error : "Retrieving the COM class factory for component with CLSID {D7FAC39E-7FF1-49AA-98CF-A1DDD316337E} failed due to the following error: 80070005 Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))"
As far as i know, it is because of not interactive nature of services.
I even tried "Allow service to interact with desktop" option for the service but it didn't work as well.I will really appreaciate any suggestion

Categories