本文介绍了与UNC路径和Windows身份验证BULK INSERT错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个服务器,一个是具有Web服务和其他服务器是一个数据库服务器,它具有的SQL Server 2005数据库应用服务器。 Web服务是一个vb.net应用程序,所有的输入文件将应用服务器上。当我的应用程序调用(通过Web服务),DB服务器与UNC路径(应用服务器)的使用Windows身份验证(集成安全性)执行BULK INSERT语句然后失败,错误 -

I have two servers, One is application server which has webservice and other server is a DB server,which has SQL server 2005 DB. Webservice is a vb.net app and all the input files will be on app server. When my application calls(through webservice) DB server to execute BULK insert statement with UNC path(of app server) using Windows authentication(Integrated security) then it fails with error -

System.Data.SqlClient.SqlException:不能批量加载,因为文件\\服务器\\文件夹\\ FILE1.TXT无法打开。 操作系统错误code 5(找不到错误)。
   在System.Data.SqlClient.SqlConnection.OnError(SqlException异常,布尔breakConnection)
   在System.Data.SqlClient.SqlInternalConnection.OnError(SqlException异常,布尔breakConnection)

System.Data.SqlClient.SqlException: Cannot bulk load because the file "\Servername\Foldername\file1.txt" could not be opened. Operating system error code 5(error not found). at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)

我为两台服务器上管理和WebService是在我的用户凭据运行,同时我为SA在SQL数据库。 SQL服务器上的本地系统帐户运行。我改变了它在我的用户帐户,但没有运气跑!然而,当我在ConnectionString中使用SQL身份验证相同的语句的工作。

I m admin on both servers and webservice is running on my user credentials and also I m SA on SQL DB. SQL server is running on Local system account. I changed it to run on my User account but no luck! However the same statement works when I use SQL authentication in connectionstring.

任何人都可以请流下在这个问题上的一些情况。

Can anyone please shed some light on this issue.

在此先感谢

推荐答案

您的客户端与SQL Server身份验证,那么SQL服务器模拟客户端并尝试访问的UNC路径。这是代表团,并含蓄地禁止。你必须采取明确的步骤来启用SQL Server服务帐户的约束委派。请参阅本文解释细节:
这篇文章是显示约束委派对ASP服务访问后端数据库,但在你的情况下,将在中间访问后端UNC共享SQL Server中。

Your client authenticates with SQL Server, then SQL Server impersonates the client and tries to access the UNC path. That is Delegation and is implicitly forbidden. You must take the explicit steps to enable constrained delegation for the SQL Server service account. See this article explaining the details: http://msdn.microsoft.com/en-us/library/ms998355.aspxThe article is shows constrained delegation for an ASP service accessing the back end database, but in your case it would be the SQL Server in the middle accessing the back end UNC share.

这篇关于与UNC路径和Windows身份验证BULK INSERT错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-29 22:25