restarting ssis package after error


  • I am developing a package that retreives data from website. Some times the response is slow and at that moment I get session time out error or server unavailable. I just restart my package manually and it works fine.

    How can I restart the package automatically?

    I am using FireError Method in the exception like so. Here is my script code for reference:

                  // Following is the test env.
                HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://balh");
                NetworkCredential myCredentials = new NetworkCredential("blah", "blah12"); //test credential not working
                request.Credentials = myCredentials;
                request.KeepAlive = false;
                request.ProtocolVersion = HttpVersion.Version10;
                request.Method = WebRequestMethods.Http.Post;
                byte[] postBytes = Encoding.ASCII.GetBytes(XMLdata);
                request.ContentType = "application/x-www-form-urlencoded";
                request.ContentLength = postBytes.Length;
                Stream dataStream = request.GetRequestStream();
                dataStream.Write(postBytes, 0, postBytes.Length);
                HttpWebResponse response = (HttpWebResponse)request.GetResponse();
                StreamReader reader = new StreamReader(response.GetResponseStream());
                tmp = reader.ReadToEnd();
                qryresponse = tmp;
            catch (Exception ex)
                bool pbCancel = false;
                this.ComponentMetaData.FireError(0, "myScriptComponent",  ex.ToString() , 0, out pbCancel);

    When the exception is thrown in BIDS all the controls (oledb source, script component and ole db command) are yellow. I am not sure how to hande this situation. I am new to the ssis and have not written OnError Eventhandler.

    Thanks for your help.

    Friday, April 06, 2012 8:19 PM


  • Hi,

    That is a sample code/script. you got to change according to your naming conventions. Please refer the links provided for detailed information on the same.

    Please use Mark or Propose as Answer if my post solved your problem and use Vote As Helpful if a post was useful.

    • Marked as answer by iworkonline Tuesday, April 10, 2012 3:32 PM
    Monday, April 09, 2012 9:35 PM

All replies