在服务器中创建excel时出错? [英] Getting error while creating excel in server ?

查看:271
本文介绍了在服务器中创建excel时出错?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试使用excel interop c在服务器中创建excel文件时出现以下错误#



System.Runtime.InteropServices.COMException(0x80040154):检索COM由于以下错误,CLSID为{00024500-0000-0000-C000-000000000046}的组件的类工厂失败:80040154未注册类(HRESULT异常:0x80040154(REGDB_E_CLASSNOTREG))。



我的代码在我的本地系统中运行,但是当我尝试部署并运行相同的时候我收到此错误?

解决方案是什么?

Am getting below error when i try to create excel file in server using excel interop c#

System.Runtime.InteropServices.COMException (0x80040154): Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).

My code is working in my local system, But when i try to deploy and runs the same am getting this error ?
What is the solution ?

推荐答案

嗯。



您确实意识到要使用InterOp到Excel,您需要在服务器上安装Excel,不要你呢?

如果你不这样做,你会得到你所看到的错误吗?

并且几乎没有任何网络服务器默认安装Office的任何部分?



说真的,你不想尝试在生产环境中互操作,因为你不太可能安装你想要的应用程序 - 出于安全考虑,你不能访问客户端上的任何安装。



具体取决于你正在努力实现,你可能会更好地看看Excel文件编写器程序集 - 其中有相当多的,有些非常好。
Um.

You do realize that to use InterOp to Excel, you need to have Excel installed on the server, don't you?
And if you don't, you get exactly the error you are seeing?
And that almost no webservers have any part of Office installed by default?

Seriously, you don;t want to try and do interop in a production environment, because it s very unlikely that the app you want will be installed - and you can't access any installation on the client for security reasons.

Depending on exactly what you are trying to achieve, you might be better off looking at Excel file writer assemblies - there are quite a few of them out there, and some are quite good.


阅读更多下的部分信息在这篇文章 [ ^ ]。



在Web应用程序中对任何Office应用程序进行互操作是一个坏主意。
Read the section under "More Information" in this article[^].

Doing interop on any Office app is a bad idea in a web application.


这篇关于在服务器中创建excel时出错?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆