ASP.NET Cannot create ActiveX component

旧城冷巷雨未停 提交于 2019-11-28 12:28:15

Following migration of our ASP.NET applications to new hardware, I investigated this issue further and came up with a solution.

To resolve the issue, open "Component Services" from Administrative Tools and navigate as follows:

  • Component Services -> Computers -> My Computer -> DCOM Config -> Microsoft Excel Application
  • Right click Microsoft Excel Application -> Properties -> Security tab
  • Click Customize for "Launch and Activation Permissions" -> Edit -> Add
  • Enter "NETWORK SERVICE", click "Check Names", click OK
  • Allow "Local Launch" and "Local Activation" for "NETWORK SERVICE" then click OK
  • Select Customize for "Access Permissions" -> Edit -> Add
  • Enter "NETWORK SERVICE", click "Check Names", click OK
  • Allow "Local Access" for for "NETWORK SERVICE" then click OK
  • Click OK

The ASP.NET application can now successfully create a Microsoft Excel worksheet containing the exported data.

Did you registered the ActiveX on the server?

http://support.microsoft.com/kb/146219

SpreadsheetGear for .NET will let you save xls and xlsx workbooks directly to a response stream with IWorkbook.SaveToStream. It is all safe managed C# code so there is no need to run anything as admin and you will not run into the problems that Excel COM Interop bring on an ASP.NET server.

You can see some simple ASP.NET Excel Reporting samples (C# and VB) using SpreadsheetGear here and download the free trial here if you want to try it yourself.

Disclaimer: I own SpreadsheetGear LLC

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!