-1

我已经完成了一个 .Net Web Service Client 来通过它发送文件并且它运行顺利;但是当我从 SQL Server 2005 的存储过程中使用该应用程序时,如下所示:

exec master.dbo.xp_cmdshell 'C:\folder\myapp user@domain.com Application "\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)
4

1 回答 1

0
Access to the path '\\192.168.1.200\folder\2012\12\file.xml' is denied.

SQL-Server 的服务帐户没有访问此文件夹的权限。您可以尝试更改 SQL-Server 的帐户(用户),或将文件放在可以访问的位置。

于 2012-12-10T18:43:26.843 回答