Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-00
Bonjour,
Je développe une application qui importe un fichier excel (formaté selon un modèle précis) avec visual, ensuite je prend les données et après traitement, réxpédie le tout sous un autre fichier excel.
En local, tout marche niquel, dès que l'on passe le code sur le serveur recette, il m'affiche un problème d'autorisation et l'erreur ci-dessus.
Nous avons vérifié que Excel était bien installé, bonne version, tous les droits ouverts, même langage etc. Rien y fais, le problème persiste.
Le problème viendrait de l'utilisation de la ligne
Code:
ExcelApplication excelappli = new ExcelApplication();
et donc pas de la connection au fichier.
Je sais que ce message revient souvent mais aucune réponse n'est arrivé à resoudre le problème. quelqun aurait-il la solution?
La page d'erreur en question
Citation:
OS Version : Microsoft Windows NT 5.2.3790 Service Pack 2
Exception Message : Exception of type 'System.Web.HttpUnhandledException' was thrown.
Exception Type : System.Web.HttpUnhandledException
Exception StackTrace : at System.Web.UI.Page.HandleError(Exception e) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest() at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) at System.Web.UI.Page.ProcessRequest(HttpContext context) at ASP.modules_administration_parc_info_tp_nouveaumateriel_aspx.ProcessRequest(HttpContext context) in c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\mytopic\9527827d\4c747558\App_Web_tp_nouveaumateriel.aspx.7f2daddf.00onl93n.0.cs:line 0 at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
Inner Exception Message : Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80070005.
Inner Exception Type : System.UnauthorizedAccessException
Inner Exception StackTrace : at Modules_Administration_Parc_Info_uc_OngletAdministrationDonnees.btnImport_Click(Object sender, EventArgs e) at System.Web.UI.WebControls.Button.OnClick(EventArgs e) at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
Voici les bouts de code qui utilise le fichier excel.
Code:
1 2 3 4 5
|
using Microsoft.Office.Interop.Excel;
using Microsoft.Office.Core;
using ExcelApplication = Microsoft.Office.Interop.Excel.Application; |
Pour se connecter au fichier
Code:
1 2 3 4 5 6
|
String sNomFichier = fuImportExcel.PostedFile.FileName;
// connection au fichier pour en extraire les données
String strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" +
"Data Source=" + sRepertoireSauvegarde +sNomFichierSauv+ ";" +
"Extended Properties=Excel 8.0;"; |
Pour créer un fichier de sortie
Code:
1 2 3 4 5 6
|
ExcelApplication excelappli = new ExcelApplication();
excelappli.Visible = false;
Workbook workbook = excelappli.Workbooks.Add(System.Reflection.Missing.Value);
Worksheet worksheet = (Worksheet)excelappli.ActiveSheet; |