如何启用阅读IIS C#的Excel文件(阅读他们当地正运行IIS工作正常上机)? [英] How to enable reading C# Excel files on IIS (reading them locally on the machine where IIS is running works fine)?

查看:327
本文介绍了如何启用阅读IIS C#的Excel文件(阅读他们当地正运行IIS工作正常上机)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有一个问题,在C#阅读Excel文件的'Microsoft.Jet.OLEDB.4.0'提供者未注册在本地计算机上。,同为'Microsoft.ACE.OLEDB.12.0'。只有当我跑我的IIS应用程序发生。 在机器上本地运行它正运行IIS工作正常。



在该计算机上Win2003的R2 x64企业运行。我开发VS2010,ASP.Net 4.0



它看起来像有2种类型这个问题的解决方案:要么安装的东西(首选)或切换到32位模式。我想知道这两种解决方案的影响,因为有这些服务器和改变服务器上运行需要大量的时间,是很痛苦的其他应用程序。




  1. 可以在安装 Microsoft Access数据库引擎2010可再发行的改变这种状况?也许我应该安装另一个版本/别的东西吗?来源:的 http://www.arboundy.com/2010/11/the-microsoft.ace.oledb.12.0-provider-is-not-registered-on-the-local-machine/

  2. 是否继的 http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/405f5bb5-87a3-43d2-8138-54b75db73aa1.mspx?mfr=true 意味着该服务器上的所有应用程序将在32位模式下运行?是否有必要这么做,如果我改变从64我的应用程序的设置的x86?我现在configuratios是任何CPU,我失去了什么,如果我将它设置为32bit的

  3. 编辑:似乎有第三种类型的解决方案,把一个dll直接在我的应用程序。它是一个很好的soluion?哪一个DLL它应该是什么?


解决方案

我用Excel工作在在项目的那一刻,据我所知添加DLL的项目是好的,特别是如果你有超过你可以在服务器上安装了什么无法控制。我知道一个大的项目,做它这样的。微软建议在部署服务器上安装Excel和使用互操作性展示,这听起来像你正在尝试做的。



我无法安装Excel到我们的部署服务器,因为我们必须与其他项目共享,所以我用的 EP加该手册可的NuGet和非常容易设置和使用。花了不到一个小时,有它产生的Excel文件。它唯一的缺点是,它只能产生XLSX文件,这是Excel文件的新类型。



这是一个简单的方法,它可能是你更轻松,适合项目。有在他们的网站,如果你想看看样品代码加载。这是给你只是一个选项,希望这是对你有用。


Got a problem with reading Excel files in C# The 'Microsoft.Jet.OLEDB.4.0' provider is not registered on the local machine., same for 'Microsoft.ACE.OLEDB.12.0'. that only occurs when I run my app on IIS. Running it locally on the machine where IIS is running works fine.

The machine in question runs on Win2003 R2 Enterprise x64. I develop in VS2010, ASP.Net 4.0.

It looks like there are 2 types of solutions to this problem: either install something (preferred) or switch to 32bit mode. I'd like to understand the implications of both solutions because there are other apps running on these servers and changing servers takes a lot of time and is very painful.

  1. Can installation of Microsoft Access Database Engine 2010 Redistributable change the situation? Maybe I should install another version/something else? Source: http://www.arboundy.com/2010/11/the-microsoft.ace.oledb.12.0-provider-is-not-registered-on-the-local-machine/
  2. Does following the instructions on http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/405f5bb5-87a3-43d2-8138-54b75db73aa1.mspx?mfr=true mean that all applications on this server will run in 32bit mode? Is it necessary to do it if I change the settings of my application from 64 to x86? My current configuratios is "Any CPU", what do I lose if I set it to 32bit?
  3. Edit: there seem to be a third type of solution, to put a dll directly in my app. Is it a good soluion? Which dll it should be?

解决方案

Hi I am working with Excel at the moment in a project, from what I know adding the dll to the project is fine especially if you have no control over what you can install on the server. I know of a large project that does it like that. Microsoft recommend installing Excel on the deployment server and using Interops, which sound like what you are trying to do.

I wasn't able to install excel onto our deployment server because we have to share it with other projects so I used EP Plus which is available on nuget and extremely easy to set up and use. It took less than an hour to have it generating Excel files. The only drawback with it is that it only generates xlsx files which are the newer type of excel files.

This is an easier approach and it may be easier and suitable for your project. There's loads of sample code on their website if you want to check it out. This is just another option for you, hopefully it is useful to you.

这篇关于如何启用阅读IIS C#的Excel文件(阅读他们当地正运行IIS工作正常上机)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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