如何为Export to Excel配置DCOM配置?

时间:2012-12-03 11:30:26

标签: asp.net export-to-excel dcom

我正在我的一个asp.net应用程序中实现Export To Excel功能。我有两个服务器(QA和开发)。在开发服务器中,它工作正常,但在QA服务器中我遇到错误。

    An exception of type System.Runtime.InteropServices.COMException occurred and was 
caught. Source:mscorlib;Message:Retrieving the COM class factory for component with CLSID 
{00024500-0000-0000-C000-000000000046} failed due to the following error: 8000401a The 
server process could not be started because the configured identity is incorrect.  Check the username and password. (Exception from HRESULT: 
0x8000401A).;Target:System.MarshalByRefObject AllocateUninitializedObject(System.RuntimeType);StackTrace:   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 XXXXXXXXXXXXX  Method - XXXXXXXXXXXXX

我在两台服务器上配置了同样的东西,但QA服务器仍无法正常工作。我接下来该怎么办?任何想法...... ??

2 个答案:

答案 0 :(得分:0)

您的QA服务器上是否安装了Excel 2000?至少它无法启动自动化......

来源:http://support.microsoft.com/kb/292491/en-us

  

Excel.Application版本独立的PROGID和   {00024500-0000-0000-C000-000000000046} CLSID。 COM相关注册表   Excel 2000的条目包括以下内容:   HKEY_CLASSES_ROOT \ Excel.Application \ CLSID默认值:   {00024500-0000-0000-C000-000000000046}   HKEY_CLASSES_ROOT \ CLSID {00024500-0000-0000-C000-000000000046} \ LocalServer32

     

默认值:C:\ PROGRA~1 \ MICROS~1 \ Office \ EXCEL.EXE / automation By   从PROGID到CLSID的注册表项之后,COM即可   了解Excel可执行文件的安装位置并启动它   自动化。

答案 1 :(得分:0)

我遇到了一个类似的问题,在会话之间身份丢失了,我不得不再次提供凭据来暂时修复它。在调查它时,我发现了一篇文章,建议授予用作“登录为批处理作业”权限的域帐户权限,因为如果未授予权限,则AD在执行更新时将丢失该身份。

https://support.microsoft.com/en-za/help/312497/prb-com-application-under-domain-account-fails-intermittently

https://www.brooksnet.com/faq/granting-logon-as-batch-privilege