C#导出Excel文件时出现问题.帮忙解决下

heliangpk 2009-07-27 05:46:02
我电脑上的EXCEl版本是2003,导出EXCEL文件时正常..
,,我在一台运行EXCEL2007的电脑上运行时确有这样的提示错误
Retrieving the COM class factory for component with CLSID {00024500-0000-000
...
我想知道的是碰到这样的问题如何解决?

...全文
387 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
sz_xd 2009-07-27
  • 打赏
  • 举报
回复
up
超维电脑科技 2009-07-27
  • 打赏
  • 举报
回复
向高手学习。
chenjianyong94 2009-07-27
  • 打赏
  • 举报
回复
你的EXCLE 多半是字数过多、
txg92 2009-07-27
  • 打赏
  • 举报
回复
个人觉得如果是简单的导出EXCEL采用gridview方式导出还比较方便,通过EXCEL组件很容易出错,不知道为什么...
wuyq11 2009-07-27
  • 打赏
  • 举报
回复
运行dcomcnfg打开组件服务,
依次展开"组件服务"->"计算机"->"我的电脑"->"COM+应用程序"
找到对应的应用程序
右键打开属性对话框,点击"标识"选项卡,
点"下列用户",把管理员(Administrator)的用户和密码(登陆服务器的密码)正确填写进去。但一旦重新装系统或者密码变化后需要重新在此处设置密码
参考
参考
十八道胡同 2009-07-27
  • 打赏
  • 举报
回复
帮你顶下下
heliangpk 2009-07-27
  • 打赏
  • 举报
回复
错误.详尽信息是:
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.IO.DirectoryNotFoundException: Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80070003.
at U8Work1.config.ExportToExcel(SqlConnection conn, String[] SqlString, String PathName, Boolean State)
at U8Work1.FrmMain.btnTransTo_Click(Object sender, EventArgs e)
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
mscorlib
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
U8Work1
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///C:/Documents%20and%20Settings/Administrator/桌面/UFWork1Setup/U8Work1.exe
----------------------------------------
System.Windows.Forms
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System.Data
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC_32/System.Data/2.0.0.0__b77a5c561934e089/System.Data.dll
----------------------------------------
System.Xml
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
System.Configuration
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Transactions
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC_32/System.Transactions/2.0.0.0__b77a5c561934e089/System.Transactions.dll
----------------------------------------
System.EnterpriseServices
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC_32/System.EnterpriseServices/2.0.0.0__b03f5f7f11d50a3a/System.EnterpriseServices.dll
----------------------------------------
Microsoft.Office.Interop.Excel
Assembly Version: 12.0.0.0
Win32 Version: 12.0.4518.1014
CodeBase: file:///C:/WINDOWS/assembly/GAC/Microsoft.Office.Interop.Excel/12.0.0.0__71e9bce111e9429c/Microsoft.Office.Interop.Excel.dll
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.


阿非 2009-07-27
  • 打赏
  • 举报
回复
这两天用ASP.NET写一个导入EXCEL数据到ORACLE的程序,调试通过,但是部署到服务器上就不能用了。

Retrieving the COM class factory for component with CLSID {00024500-0000-000



后来终于解决:

在服务器上,

1,运行dcomcnfg打开组件服务

2,依次展开"组件服务"->"计算机"->"我的电脑"->"DCOM配置"

3,找到"Microsoft Excel应用程序"

右键打开属性对话框

点击"安全"选项卡,

把"启动和激活权限","配置权限",都选择为自定义,

然后依次点击它们的编辑,把ASPNET添加进去,并加入所有的权限...

OK,解决!


http://blog.csdn.net/zijings8374/archive/2008/09/03/2875258.aspx

110,567

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧