Rettighedsproblemer for ASP.NET til Excel
Jeg har en web-applikation der er genereret I “Visual Studio 2005” vha. c#. I Global.asax bliver der åbnet en Excel-Application. Dette har fungeret fint hidtil, men jeg forsøger nu at flytte applikationen over på en anden computer. Der benyttes IIS, og der bruges ”localhost” – altså ligger server og klient på samme maskine. Jeg har sat det pågældende virtuelle direktorys options i IIS til alle rettigheder, jeg har kunnet tænke på. Men jeg får stadig samme fejl:Server Error in '/Prototype10' Application.
Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80070005.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
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.
ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity. ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5 or Network Service on IIS 6) that is used if the application is not impersonating. If the application is impersonating via <identity impersonate="true"/>, the identity will be the anonymous user (typically IUSR_MACHINENAME) or the authenticated request user.
To grant ASP.NET access to a file, right-click the file in Explorer, choose "Properties" and select the Security tab. Click "Add" to add the appropriate user or group. Highlight the ASP.NET account, and check the boxes for the desired access.
Source Error:
Line 43: Line 44: Excel.Application excelApp;Line 45: excelApp = new Excel.ApplicationClass();// Creates a new Excel ApplicationLine 46: excelApp.Visible = false;Line 47: Application["ExcelApp"] = excelApp;
Source File: d:\Inetpub\wwwroot\Prototype10\Global.asax Line: 45
Stack Trace:
[UnauthorizedAccessException: Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80070005.] ASP.global_asax.Application_Start(Object sender, EventArgs e) in d:\Inetpub\wwwroot\Prototype10\Global.asax:45
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42