how to programmatically kick off a ssis package in MVC3 to import excel files

I am having some trouble with a MVC3 web application that I am developing. I need an upload page which Allows the user to upload excel files and dump them to the file system. I got this to work fine. The next part is the part that I am having trouble with, After I upload the excel files I need to programmatically kick off a SSIS package which I have created already to import the excel files.

Here is what I have so far in code:

    // POST: /Home/Update/
    public ActionResult Update(HttpPostedFileBase file)
        // Verify that the user selected a file
        if (file != null && file.ContentLength > 0)

            var fileName = Path.GetFileName(file.FileName);

            // store the file inside ~/App_Data/uploads folder
            var path = Path.Combine(Server.MapPath("~/App_Data/uploads"), fileName);
            ViewBag.Message = "File Uploaded Successfully";


        //Start the SSIS here

            Application app = new Application();

            Package package = null;
            package = app.LoadPackage( @"C:\Users\Chris\Documents\Visual Studio
            2008\Projects\Integration Services Project1\Integration Services Project1
            \bin\Package.dtsx", null);

            // Execute Package
            DTSExecResult results = package.Execute();

            if(results == DTSExecResult.Failure)
                foreach(DtsError local_DtsError in package.Errors)
                    ViewBag.Message("Package Execution results:{0}",  
        catch(DtsException ex)
            //ViewBag.Message("{0} Exception caught.", ex);


        // redirect back to the index action to show the form once again
        return RedirectToAction("Update");

When I run the code and upload an excel file I get a DtsException caught, which says:

Failed to open package file "C:\Users\Chris\Documents\Visual Studio 2008\Projects\Integration Services Project1\Integration Services Project1\bin\Package.dtsx" due to error 0x80070003 "The system cannot find the path specified.". This happens when loading a package and the file cannot be opened or loaded correctly into the XML document. This can be the result of either providing an incorrect file name was specified when calling LoadPackage or the XML file was specified and has an incorrect format.

I don't understand why it is giving me this because the file path is right I checked and it is exactly correct. I need some help fixing this issue I would greatly appreciate any help you guys can give.


Permissions I should think. Put the file somewhere where account running IIS can see it. Whereever you were planning on deploying it, would be good.

Need Your Help

FileNotFoundException when reading .xml file to parse

java xml-parsing filenotfoundexception

I'm writing a program in Java where I read in data from an XML file and parse it. The file is imported into a folder named "Resources" in the src directory of my project. I'm using Eclipse. When I ...