简体   繁体   English

Microsoft.ACE.OleDB.12.0 + Windows Server 2008 R2 +电子表格通过UNC路径访问SharePoint = :(

[英]Microsoft.ACE.OleDB.12.0 + Windows Server 2008 R2 + Spreadsheet being accessed via UNC path into SharePoint = :(

Here's a very specific question. 这是一个非常具体的问题。 I have a developer who is attempting to open an excel document through the UNC path \\\\sharepoint.site.com\\sites\\site\\library\\folder one\\test.xlsx , using the Microsoft.ACE.OleDB.12.0 provider, in C# code running on IIS7 on Windows Server 2008 R2 . 我有一个开发人员正在尝试使用C#中的Microsoft.ACE.OleDB.12.0提供程序通过UNC路径\\\\ sharepoint.site.com \\ sites \\ site \\ library \\ folder one \\ test.xlsx打开excel文档。 Windows Server 2008 R2上的IIS7上运行的代码。

Once we sorted out even getting the provider to be recognized on the server, we ran into the following error: 一旦我们整理出来,甚至供应商在服务器上得到认可,我们遇到了以下错误:

The Microsoft Office Access database engine cannot open or write to the file '\\\\sharepoint.site.com\\sites\\site\\library\\folder one\\test.xlsx'. Microsoft Office Access数据库引擎无法打开或写入文件'\\\\ sharepoint.site.com \\ sites \\ site \\ library \\ folder one \\ test.xlsx'。 It is already opened exclusively by another user, or you need permission to view and write its data 它已经由另一个用户专门打开,或者您需要权限才能查看和写入其数据。

Looking at the Security log on our SharePoint WFE, I can see that the app pool identity is logging in successfully upon the call to conn.Open() , and it does indeed have Full Control over the site being accessed. 查看我们的SharePoint WFE上的安全日志,可以看到在调用conn.Open() ,应用程序池标识已成功登录,并且确实可以完全控制要访问的网站。 So what gives? 那有什么呢? Has anyone by chance run into this before? 有人偶然碰到过这个吗? The code being used is below: 使用的代码如下:

string connectionString = @"Provider=Microsoft.ACE.OLEDB.12.0; Data Source=\\sharepoint.site.com\sites\site\library\folder one\test.xlsx;Extended Properties=""Excel 12.0;""";

OleDbConnection conn = new OleDbConnection(connectionString);

conn.Open();

UNC pathing was my exact issue. UNC路径是我的确切问题。 On my local machine, I could connect to my desired excel document and work with rows from the excel document without an issue. 在我的本地计算机上,我可以连接到所需的excel文档,并且可以毫无问题地处理excel文档中的行。 When I however deployed my website to the server, it would connect to the excel document using the below connection string but no rows would be returned. 但是,当我将网站部署到服务器时,它将使用下面的连接字符串连接到excel文档,但不会返回任何行。 My connection string was: 我的连接字符串是:

string.Format("Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0};Extended Properties=\"Excel 12.0;HDR=YES\";", filePath); //where filePath is the excel document file name

Using OleDbConnection.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null); 使用OleDbConnection.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null); to return the TABLE_NAME/Sheet of the excel doc which returned no results on the server. 返回excel文档的TABLE_NAME / Sheet,该文档在服务器上未返回任何结果。

What I found was that the web server (IIS) connected via UNC to retrieve the website files on another server but as David mentions above, ACE is very temperamental with UNC pathing. 我发现是通过UNC连接的Web服务器(IIS)检索另一台服务器上的网站文件,但是正如David上面提到的,ACE具有UNC路径的气质。 Using System.Web.HttpContext.Current.Server.MapPath sorts this out. 使用System.Web.HttpContext.Current.Server.MapPath此问题。 Here is my final connection string: 这是我的最终连接字符串:

string.Format("Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0};Extended Properties=\"Excel 12.0;HDR=YES\";", System.Web.HttpContext.Current.Server.MapPath(filePath));

Turns out that it didn't like the load balanced address for the farm for whatever reason. 事实证明,无论出于何种原因,它都不喜欢服务器场的负载平衡地址。 Explicitly targeting one of the Web Front-Ends in the UNC path worked. 明确地以UNC路径中的Web前端之一为目标。 I hope this helps someone else out there who encounters the same issue! 希望这对其他遇到相同问题的人有所帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在Windows Server 2003上替代Microsoft.ACE.OLEDB.12.0 - Substitute for Microsoft.ACE.OLEDB.12.0 on Windows Server 2003 Visual Studio 2008中出现Ssis microsoft.ace.oledb.12.0错误 - ssis microsoft.ace.oledb.12.0 error in Visual Studio 2008 Windows 10中无法识别“ Microsoft.ACE.OLEDB.12.0” - "Microsoft.ACE.OLEDB.12.0” not recognized in Windows 10 'Microsoft.ACE.OLEDB.12.0' 提供程序未在本地计算机(服务器)上注册 - The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine (server) 未在生产服务器上注册“ Microsoft.ACE.OLEDB.12.0”提供程序 - The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the Production Server Windows服务器中的本地计算机错误未注册“ Microsoft.ACE.OLEDB.12.0”提供程序 - The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine error in windows server Microsoft.ACE.OLEDB.12.0 CSV ConnectionString - Microsoft.ACE.OLEDB.12.0 CSV ConnectionString Microsoft.ACE.OLEDB.12.0提供程序未注册 - Microsoft.ACE.OLEDB.12.0 provider is not registered 没有'Microsoft.ACE.OLEDB.12.0'错误的解决方案 - No solution for 'Microsoft.ACE.OLEDB.12.0' error 使Microsoft.jet.oledb.4.0或microsoft.ace.oledb.12.0在64位Windows 7计算机上工作 - Getting Microsoft.jet.oledb.4.0 or microsoft.ace.oledb.12.0 to work on 64 bit Windows 7 machine
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM