Click here to Skip to main content
Click here to Skip to main content

Deployment Of Web Application Executing SSIS Package In Web Server.

By , 4 Sep 2008
 

Sample Image - maximum width is 600 pixels

Introduction

Recently I was working on the module that has SSIS package that needs to be called from ASP.net web page. We have two production server one is web server (.Net Framework 2.0- IIS 6.0) and other one is Database server (SQL Server). The challenge we face was to deployed web application calling SSIS -Dtsx package from .net environment as a file system. This article describes prerequisites required before one go on for deployment into production.

1.Deployment Checklist And Important Notes

1.Installed Integration service In Web Server

Make sure Web server in which web application is going to be deployed has Integration service installed. It does not require database to be installed. This will help to include references Microsoft.SqServer.ManagedDTS in Global Cache Assembly.

Reference :

       using Microsoft.SqlServer.Dts.Runtime;
        
       protected void btnExecute_Click(object sender, EventArgs e)
       {
            Application app = new Application();
            Package package = null;
            try
            {
            string fileName = 
Server.MapPath(System.IO.Path.GetFileName(FileUpload1.PostedFile.FileName.ToString()));
            FileUpload1.PostedFile.SaveAs(fileName);
            
            //Load DTSX
            package = 
app.LoadPackage(@"D:\SSIS_ASP_NET\SSIS_ASP_NET_DEMO\SSIS_ASP_NET_DEMO\Package1.dtsx", null);
            
            //Global Package Variable
            Variables vars = package.Variables;
            vars["Business_ID"].Value = txtBusinessID.Text;
            vars["Business_Name"].Value = txtBusinessName.Text;
            
            //Specify Excel Connection From DTSX Connection Manager
            package.Connections["SourceConnectionExcel"].ConnectionString =
 "provider=Microsoft.Jet.OLEDB.4.0;data source=" + fileName + ";Extended Properties=Excel 8.0; ";
            
            //Execute DTSX.
            Microsoft.SqlServer.Dts.Runtime.DTSExecResult results = package.Execute();
        }
        catch (Exception ex)
        {
            throw ex;
        }
        finally
        {
            package.Dispose();
            package = null;
        }
    }

        

Sample Image - maximum width is 600 pixels

Sample Image - maximum width is 600 pixels

Sample Image - maximum width is 600 pixels

2.If Migrated From SQL Server 2000 To SQL Server 2005

Database server having SQL server 2000 and SQL Server 2005 both installed in same box, make sure SQL server 2000 is stopped. Check the connection string in web application .See below if you get this error

"SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80004005. An OLE DB record is available. Source: "Microsoft OLE DB Provider for SQL Server" Hresult: 0x80004005 Description: "[DBNETLIB][ConnectionOpen (Invalid Instance()).]Invalid connection.". 8/12/2008 5:31:38 PM SSIS Error Code DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER. The AcquireConnection method call to the connection manager "DestinationConnectionOLEDB" failed with error code 0xC0202009. There may be error messages posted before this with more information on why the AcquireConnection method call failed. 8/12/2008 5:31:38 PM component "Destination - XXXX" (41) failed validation and returned error code 0xC020801C. 8/12/2008 5:31:38 PM One or more component failed validation. 8/12/2008 5:31:38 PM There were errors during task validation. 8/12/2008 5:31:38 PM "

Resolution to this to include instance name and port in DATA SOURCE property.

< data source=10.10.10.10/Yukon,1533;initial catalog=NorthWind;UID=xxx;PWD=xxx; Connect Timeout=300>

3.Web application having Enterprise Library

Add pooling =false in connection string to disable database connection pooling mechanism

< data source=10.10.10.10/Yukon,1533;initial catalog=NorthWind;UID=xxx;PWD=xxx; Connect Timeout=300;pooling=false>

Conclusion

Any corrections and inputs are most welcome.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

santosh poojari
Technical Lead
India India
Member
He is presently working as tech arch in one of the leading IT company.He has total 10 years of experience in C#.net. He is a B.E graduate in Computers from Bombay University.
 
Most of his experiences are in designing architect for end to end solutions. His interest areas are WCF,Spring.net,Architecture- Model View Presenter,UML,Webservice,Performance Engineering/tuning,Design patterns,Generics,Enterprise Library,Regular expressions,Silverlight and WWF.
www.santoshpoojari.blogspot.com

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
QuestionExecute SQL Task Expressionmemberirfunme15 Oct '12 - 5:58 
Hi
Wonderful article and helped me a lot, thanks for sharing. However I am having an issue while calling my SSIS package through a .NET application in C#. If I use Expressions in my Execute SQL Task on SqlStatementSource Property the .NET application is unable to evaluate the expressions and I am getting following error. Can you please look into this and let me know what would be the problem. I have gone through many articles but no luck on this issue. If I take out the Expression from my Execute SQL Task the package is working fine if I call it from .Net application. If i use expressions in my Execute SQL Task I am getting following error whereas the package can be executed successfully independently(not from .net application).
Error:
The result of the expression "" on property "SqlStatementSource" cannot be written to the property. The expression was evaluated, but cannot be set on the property.
Thanks
GeneralFailure [modified]membermallyonline20 Mar '11 - 5:12 
Hi Santosh, Well done on a great article.
 
My results are Failure
Microsoft.SqlServer.Dts.Runtime.DTSExecResult results = package.Execute();
            Labelex.Text += "<br/>" + results.ToString();
 
I have no idea why but the data never gets written to the database and when I write out the results it just says failure. Any idea why this may be?
 
I changed your code ever so slightly as follows
 
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Microsoft.SqlServer.Dts.Runtime;
public partial class _Default : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {
 
    }
 
    protected void btnExecute_Click(object sender, EventArgs e)
    {
        Application app = new Application();
        Package package = null;
        try
        {
            //string fileName = Server.MapPath(System.IO.Path.GetFileName(FileUpload1.PostedFile.FileName.ToString()));
            //FileUpload1.PostedFile.SaveAs(fileName);

            string fileName = Server.MapPath("~/") + FileUpload1.PostedFile.FileName.ToString();
            FileUpload1.SaveAs(fileName);
            Labelex.Text += fileName + "<br/>"; 
 
            //Load DTSX
            package = app.LoadPackage(@"E:\inetpub\wwwroot\mysitefolder\Packages\SSIS_DEMO\Package1.dtsx", null);
            Labelex.Text += package.ToString();
 
            //Global Package Variable
            Variables vars = package.Variables;
            vars["Business_ID"].Value = txtBusinessID.Text;
            vars["Business_Name"].Value = txtBusinessName.Text;
            
            //Specify Excel Connection From DTSX Connection Manager
            package.Connections["SourceConnectionExcel"].ConnectionString = "provider=Microsoft.Jet.OLEDB.4.0;data source=" + fileName + ";Extended Properties=Excel 8.0; ";
            
            //Execute DTSX.
            Microsoft.SqlServer.Dts.Runtime.DTSExecResult results = package.Execute();
            Labelex.Text += "<br/>" + results.ToString();
        }
        catch (Exception ex)
        {
            Labelex.Text += "<br/>" + ex.ToString();
            
            //throw ex;
        }
        finally
        {
            //package.Dispose();
            package = null;
        }
    }
}
 

 
I am inserting to a remote sql server and verified the connection is ok in OLE DB Destination Editor. Does the remote sql server require compatibility with SSIS for this to work or is it just the 2 storeproc DeleteBusinessEntry and UpdateBusinessEntry?
 
UPDATE: I have now been able to run the package with some success from a console app using sample code from the article located Here however on checking my data it has copied export 4 times!! ?
 
Regards
Mal

modified on Sunday, March 20, 2011 12:36 PM

GeneralMissing.....Microsoft.SqServer.ManagedDTSmemberjeffrey reed24 Sep '09 - 9:30 
San, Your example is very helpful, however, on my machine I can't find this dll. I have Vista, SQL 2008 Ent SP1, VS2008 SP1, and .NET 3.5 SP1. I thought I read somewhere else that I needed 3.5 SDK, but apparently there is no such thing yet. What else do I need to instal in order to be able to reference this file?
 
THanks, Jeff
GeneralRe: Missing.....Microsoft.SqServer.ManagedDTSmemberRavikumar Purad8 Aug '12 - 21:24 
Follow the below stpes:

1. Run C:\Windows\assembly\gac_msil in the Run box from Start
 
2. Find the dll in folder Microsoft.SqlServer.ManagedDTS
 
3. Copy the dll
 
4. Refer the dll in your application.
:java:
Ravikumar Purad

GeneralProblem in accessing SSIS package after deploying web application...memberavik1023 Nov '08 - 2:14 
Hi Santosh,
 
I am facing one problem in the same scope.
After build and running the solution if I click on the execute button, the whole thing (activating SSIS packages from ASP.Net) works fine.
But, after hosting the web site in the IIS, then accessing the site via browse option and clicking on execute button results in void.
 
In another case I have deployed SSIS package in the file system and tried to access it from the hosted web site. It results in 'Access denied' error.
 
Though it had worked after I deployed the SSIS pkg in SQL Server, but, I dont know how to access that deployed pkg in SQL server from asp.net.
 
If you have any answer, then please help...
 
Thanks,
Avik
 
Aka

GeneralRe: Problem in accessing SSIS package after deploying web application...membermbaocha6 May '09 - 16:48 
Am i so naive that I do not know the meaning of SSIS? please what does SSIS package refers to?
 
________________________________________
Cheap Affordable Web Hosting | Windows Linux PHP ASPX MYSQL Website Hosting | Best Web Design & Development Company
GeneralRe: Problem in accessing SSIS package after deploying web application...memberpramodrenikindi21 Jul '09 - 18:14 
Use unc path to access the dtsx package
 
app.LoadPackage(@"\\servername\sharename\Package1.dtsx", null);
 
Make sure that the application running undar a user able to access that path.
GeneralThanks for sharingmemberAbhijit Jana4 Sep '08 - 18:45 
Thanks for sharing. its realy helpful.
 
5 from me !!!
 
Read My Latest Article : IIS 7.0 and Deploying Asp.Net WebSites on IIS 7.0
 
cheers,
Abhijit

GeneralRe: Thanks for sharingmembersantosh poojari16 Sep '08 - 21:33 
Thanks Buddy
 
Happy Coding
"San"
 

 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Permalink | Advertise | Privacy | Mobile
Web01 | 2.6.130523.1 | Last Updated 5 Sep 2008
Article Copyright 2008 by santosh poojari
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid