C# 使用SQL Server 2005从路径加载文件的问题

C# 使用SQL Server 2005从路径加载文件的问题,c#,.net,sql-server,xml,file-io,C#,.net,Sql Server,Xml,File Io,我做了一个.NETWeb服务客户端,通过它发送一个文件,它工作得很顺利;但当我从SQL Server 2005的存储过程中使用该应用程序时,如下所示: exec master.dbo.xp\u cmdshell“C:\folder\myapp”user@domain.com应用程序“\192.168.1.200\folder\2012\12\file.xml” 我得到这个错误: Unhandled Exception: System.UnauthorizedAccessException: Ac

我做了一个.NETWeb服务客户端,通过它发送一个文件,它工作得很顺利;但当我从SQL Server 2005的存储过程中使用该应用程序时,如下所示:

exec master.dbo.xp\u cmdshell“C:\folder\myapp”user@domain.com应用程序“\192.168.1.200\folder\2012\12\file.xml”

我得到这个错误:

Unhandled Exception: System.UnauthorizedAccessException: Access to the path '\\192.168.1.200\folder\2012\12\file.xml' is denied.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath) 
NULL
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
   at System.IO.StreamReader..ctor(String path, Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize)
   at System.IO.StreamReader..ctor(String path, Encoding encoding)
   at System.IO.File.InternalReadAllText(String path, Encoding encoding)
   at System.IO.File.ReadAllText(String path)
   at myapp.Program.Main(String[] args)
SQL Server的服务帐户无法访问此文件夹。
您可以尝试更改SQL Server的帐户(用户),或将文件放在可访问的位置。

您的SQL Server运行在哪个帐户下?此帐户是否具有访问此文件的权限?
Access to the path '\\192.168.1.200\folder\2012\12\file.xml' is denied.