0
SSIS 패키지에 스크립트 작업이 있습니다. 이 작업은 Visual Studio 2015에서 훌륭하게 작동합니다. 그러나 패키지를 배포하고 SSMS를 통해 실행하면 작업 스크립트는 sucessful을 표시하지만 매우 빠르게 실행되고 파일이 만들어지지 않습니다. 내 코드는 SSISDB 카탈로그에 배포 할 때 로컬이 아닌 실행하면 모든 것이 괜찮습니다, farily 간단 (URL에서 파일을 그랩 및 네트워크 위치에 저장합니다) 내가 말했듯이SSIS 스크립트 작업 (예정대로 작동하지 않음)
Public Sub Main()
Dim url, destination As String
destination = Dts.Variables("StagingPath").Value.ToString + Dts.Variables("DeliveryFile").Value.ToString
url = Dts.Variables("ReportURL").Value.ToString
'Delete staging file if it exists
Try
If IO.File.Exists(destination) Then IO.File.Delete(destination)
Dim result As Boolean = SaveFile(url, destination)
If result = True Then
Dts.TaskResult = ScriptResults.Success
Else
Dts.TaskResult = ScriptResults.Failure
End If
Catch ex As Exception
Dts.TaskResult = ScriptResults.Failure
End Try
End Sub
Protected Function SaveFile(ByVal url As String, ByVal localpath As String) As Boolean
Dim loRequest As System.Net.HttpWebRequest
Dim loResponse As System.Net.HttpWebResponse
Dim loResponseStream As System.IO.Stream
Dim loFileStream As New System.IO.FileStream(localpath, System.IO.FileMode.Create, System.IO.FileAccess.Write)
Dim laBytes(256) As Byte
Dim liCount As Integer = 1
Try
loRequest = CType(System.Net.WebRequest.Create(url), System.Net.HttpWebRequest)
loRequest.Credentials = System.Net.CredentialCache.DefaultCredentials
loRequest.Timeout = 600000
loRequest.Method = "GET"
loResponse = CType(loRequest.GetResponse, System.Net.HttpWebResponse)
loResponseStream = loResponse.GetResponseStream
Do While liCount > 0
liCount = loResponseStream.Read(laBytes, 0, 256)
loFileStream.Write(laBytes, 0, liCount)
Loop
loFileStream.Flush()
loFileStream.Close()
'Success
SaveFile = True
Catch ex As Exception
SaveFile = False
End Try
End Function
. 전달 된 URL은 SSRS 서버의 로컬 리소스 (pdf 파일)입니다.
SQL 에이전트 서비스 계정 사용자에게 권한을 확인하십시오. @ plaidDK와 같은 – plaidDK
이 말했다. 특히 상담원 서비스 계정 – KeithL
의 인터넷 측면은 캐치 히트를 시도하기 때문에 성공합니다. catch에서 어딘가에 오류 메시지를 작성할 수 있습니다. – KeithL