I have a weird issue when downloading some zip files from websites.
My solution is working fine when I run from Visual Studio manually.
When I deployed on to the server, it did not run.
Below is the error I am getting.
I RDP'ed on to the Server on which the jobs are scheduled and opened the browser, typed one ( any one out of many job ursl) URL Manually. After this was done, my Jobs( on SQL Server Agent )started running successfully.
But It ran successfully for few runs( I scheduled my job to run every 15 mins) and then stopped again with the same error message.
FYI... I am using a Proxy Account to run my Jobs on SQL Server Agent.
Below is the code I am using in Script Task to download my files.
public void Main()
{
try
{
// TODO: Add your code here
bool fireAgain = true;
Dts.Events.FireInformation(0, "Download File", "Start downloading " + Dts.Variables["ServerURL"].Value.ToString(), string.Empty, 0, ref fireAgain);
// Create a webclient to download a file
WebClient mySSISWebClient = new WebClient();
mySSISWebClient.Credentials = new System.Net.NetworkCredential(Dts.Variables["ServerUserName"].Value.ToString(), Dts.Variables["ServerPassword"].Value.ToString());
mySSISWebClient.DownloadFile(Dts.Variables["ServerURL"].Value.ToString(), Dts.Connections["myProductFile"].ConnectionString);
// Logging end of download
Dts.Events.FireInformation(0, "Download File", "Finished downloading " + Dts.Connections["myProductFile"].ConnectionString, string.Empty, 0, ref fireAgain);
// Quit Script Task succesful
Dts.TaskResult = (int)ScriptResults.Success;
//Dts.TaskResult = (int)ScriptResults.Success;
}
catch (Exception Ex)
{
Dts.Events.FireError(0, "ERROR", Ex.Message, null, 0);
Dts.TaskResult = (int)ScriptResults.Failure;
}
}