.net - Executing SSIS package from WCF service -


i trying execute ssis package wcf service, initialising ssis variable using method(runpackage(input1, input2)).

  • input 1: path of excel file,
  • input 2: package path

when deploy wcf on iis , call method (runpackage(input1, input2)) using web service, getting package failed message.

wcf , ssis packages @ server1 (db server), excels @ sever2. server2 has access server1

following code in runpackage method in wcf

    strxlpath = @"\\server1\excel1.xlsx";     strpackagepath = @"e:\package.dtsx";      public static string runpackage(string strxlpath, string strpackagepath)     {         string strresult = "fail";          try         {             package pkg;             application app;             dtsexecresult pkgresults;                             //microsoft.sqlserver.dts.runtime.configuration cnfg;              strpackagepath = strpackagepath.replace("e:", "\\\\server2");             //check if excel exists             system.io.fileinfo fixlfile = new system.io.fileinfo(strxlpath);             system.io.fileinfo fipkgfile = new system.io.fileinfo(strpackagepath);              //impersonate.impersonateuser("domain", "userid", "pwd");             if (fixlfile.exists)             {                 strresult = "xl exists";                 if (fipkgfile.exists)                 {                     strresult = "package exists";                                            #region call package application                      app = new application();                     pkg = app.loadpackage(strpackagepath, null);                      variables pkgvars = pkg.variables;                     string excelpath = "";                      #endregion                      #region package variables initi                     foreach (variable pkgvar in pkgvars)                     {                         if (!pkgvar.systemvariable)                         {                             if (pkgvar.name == "connstr")                             {                                                                                pkgvar.value = "data source=server2;user id=userid;initial catalog=dbname;password=password;provider=sqlncli10.1;persist security info=true;auto translate=false;";                                                                      }                             else                                 if (pkgvar.name == "excel_path")                                 {                                     pkgvar.value = strxlpath;                                     excelpath = pkgvar.value.tostring();                                 }                         }                     }                     #endregion                      #region run package                                                                    pkgresults = pkg.execute();                      console.writeline(pkgresults.tostring());                      strresult = "package" + pkgresults.tostring();                      #endregion                                        }                 else                 {                     strresult = "package doesnt exists.";                 }             }             else             {                 strresult = "xl doesnt exists";             }             //impersonate.undoimpersonation();             return strresult;         }         catch (exception)         {             return strresult = "error in method";         }     }         } 

please me.


Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -