Quantcast
Channel: Security forum
Viewing all articles
Browse latest Browse all 12072

WCF Service Running Excel Gets 80070005 error

$
0
0

We have a WCF service that returns Excel formatted reports to our users. The process works correctly in Visual Studio 2010 debug on local Windows 7 PC's using IIS Express for local WCF calls. However Windows 2008 Server 2 using IIS generates the error below:

Pda.Excel CopyDataToReport failed 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)).
   at System.Runtime.Remoting.RemotingServices.AllocateUninitializedObject(RuntimeType objectType)
   at System.Runtime.Remoting.Activation.ActivationServices.CreateInstance(RuntimeType serverType)
   at System.Runtime.Remoting.Activation.ActivationServices.IsCurrentContextOK(RuntimeType serverType, Object[] props, Boolean bNewObj)
   at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
   at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache)
   at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean skipCheckThis, Boolean fillCache)
   at System.Activator.CreateInstance(Type type, Boolean nonPublic)
   at System.Activator.CreateInstance(Type type)
   at Pda.Excel.Program.Main(String[] args)

The C# code stuffs data into an Excel worksheet and then instantiates Excel to invoke a macro to format data in the report. Once the report is 'stuffed' the Excel workbook is sent to a user (and yes I know the data is static in the report, that is what we want). The process fails on the following line:

Microsoft.Office.Interop.Excel.

ApplicationoXL =newMicrosoft.Office.Interop.Excel.Application();

To resolve the problem we have tried the following: 1) On the Windows 2008 server we have set Excel to run as Admin; 2) Installed Office 2010 PIA's; 3) Making the Excel workbook folders a trusted location; 4) Changing the advanced threadpool of IIS for the Pda.Wcf to permit 32-bit  applications to run; 5) Offloading the Excel macro call from the WCF to a console application, and when we manually test, the stuffing process runs fine via cmd boxes either open as Admin or normal.

This seems to us a server permissions issue.

Can anyone help?


Viewing all articles
Browse latest Browse all 12072

Trending Articles