2012-12-10 2 views
-1

.net 웹 서비스 클라이언트를 통해 파일을 보내고 원활하게 작동합니다. 하지만이 응용 프로그램을 SQL Server 2005의 Store 프로 시저에서 다음과 같이 사용하면 :SQL Server 2005를 사용하여 경로에서 파일을로드하는 문제

exec master.dbo.xp_cmdshell 'C : \ folder \ myapp [email protected] 응용 프로그램'\ 192.168.1.200 \ folder \ 2012 \

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) 
+1

귀하의 Sql Server는 어떤 계정으로 실행되고 있습니까? 이 계정에이 파일에 대한 액세스 권한이 있습니까? –

답변

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

SQL-서버의 서비스 계정에 대한 액세스 권한이 폴더가 없습니다 : 12 \ file.xml " '

나는이 오류가 발생합니다. SQL Server의 계정 (사용자)을 변경하거나 액세스 할 수있는 곳에 파일을 배치 할 수 있습니다.

관련 문제