How to add an external dll to IIS and solve the error 80070005


Here is the situation: I spent a couple of weeks developping a c# web form app, it is meant to be deployed on a server locally, so the obvious solution is to use IIS. Once tested, it works fine, I even had Visual Studio installed on the server, I run the app within Visual Studio, everything is going well.

When I publish the app from visual studio, and put the file system generated inside inetpub/wwwroot... the first pages load fine but once the app tries to do a process that needs an external library, an exception is unexpectedly raised.

When I look at the log generated, I know that the exception is raised exectly on the first external library object instanciated. So clearly, once deployed on IIS app has no reference for the libraries or doesn't have the rights to access them.

Here is the stackque of the exception:

[UnauthorizedAccessException: La récupération de la fabrique de classes COM pour le composant avec le CLSID {00024500-0000-0000-C000-000000000046} a échoué en raison de l'erreur suivante : 80070005 Accès refusé. (Exception de HRESULT : 0x80070005 (E_ACCESSDENIED)).]
   ExcelDataRetreiver..ctor(String Path) +163
   FacturePR..ctor(String Path, Double CourDevise) +273
   FacturePRP.Button1_Click2(Object sender, EventArgs e) +314
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +11594496
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +274
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1964

The external library whose objects can't be instanciated is: Microsoft.Office.Interop.Excel but i don't think it will be the only one since I'm using a more external libraries.

Thanks in advance,


To make sure that at this point that the library Microsoft.Office.Interop.Excel is not responsible for this particular error, at least not at this point, I skipped the part where handling an excel file is needed to go directly to an other part of the web app where Objects from an external library(other than Microsoft.Office.Interop.Excel) are instanciated, an exception is I still raised get a similar error message from the log :

Retrieving the COM class factory for component with CLSID {XXXX} failed due to the following error: 80040154
asked on Stack Overflow Jan 21, 2020 by Marouane • edited Jan 22, 2020 by Marouane

0 Answers

Nobody has answered this question yet.

User contributions licensed under CC BY-SA 3.0