Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ssis/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用WCF从远程运行SSI_Wcf_Ssis - Fatal编程技术网

使用WCF从远程运行SSI

使用WCF从远程运行SSI,wcf,ssis,Wcf,Ssis,我有一个web服务调用ssis,在本地主机上没有问题。但当我部署它时,它不会运行,也不会给出任何错误。我应该在哪里更改以允许远程请求?我相信有什么东西可以阻止你。。。这是我的密码 public class blaService : IblaService { [WebMethod] [WebGet(UriTemplate = "runSSISPackage/{Id}")] public string runSSISPackage(string Id) {

我有一个web服务调用ssis,在本地主机上没有问题。但当我部署它时,它不会运行,也不会给出任何错误。我应该在哪里更改以允许远程请求?我相信有什么东西可以阻止你。。。这是我的密码

public class blaService : IblaService
{

    [WebMethod]
    [WebGet(UriTemplate = "runSSISPackage/{Id}")]
    public string runSSISPackage(string Id)
    {
        try
        {
            string pkgLocation = ConfigurationManager.AppSettings["dtsxPath"].ToString();

            Package pkg;
            Application app;
            DTSExecResult pkgResults;
            Variables vars;

            string databaseName, tableName, minId, maxId, sCreatedDateTime, filePathTemplate, folderName;
            Int64 fileRowAmount, fileCount;
            using (SqlConnection sqlConnection = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString.SQL Server (SqlClient)"].ConnectionString.ToString()))
            {
                sqlConnection.Open();
                SqlCommand sqlCommand = new SqlCommand("select * from dbo.Table where Id=" + Convert.ToInt32(Id), sqlConnection);
                sqlCommand.CommandTimeout = 0;
                SqlDataReader reader = sqlCommand.ExecuteReader();

                if (reader.Read())
                {

                    databaseName = reader["DatabaseName"].ToString();
                    tableName = reader["TableName"].ToString();
                    minId = reader["MinimumId"].ToString();
                    maxId = reader["MaximumId"].ToString();
                    fileRowAmount = Int64.Parse(reader["FileRowAmount"].ToString());
                    fileCount = Int64.Parse(reader["FileCount"].ToString());
                    sCreatedDateTime = Convert.ToDateTime(reader["CreatedDateTime"]).ToString("yyyyMMddHHmmss");

                    filePathTemplate = ConfigurationManager.AppSettings["outputFilePath"].ToString();
                    folderName = "bla_" + sCreatedDateTime;

                    if (!Directory.Exists(string.Format(filePathTemplate + "\\{0}", folderName)))
                    {
                        Directory.CreateDirectory(string.Format(filePathTemplate + "\\{0}", folderName));
                    }

                    app = new Application();
                    pkg = app.LoadPackage(pkgLocation, null);
                    vars = pkg.Variables;
                    vars["DBName"].Value = "bla_PasswordPool";
                    vars["FileCount"].Value = fileCount;
                    vars["FileName"].Value = "bla_" + sCreatedDateTime + "_1of1.txt";
                    vars["FileNamePrefix"].Value = "bla_" + sCreatedDateTime + "_";
                    vars["FileRowAmount"].Value = fileRowAmount;
                    vars["i"].Value = 0;
                    //vars["OutputFolder"].Value = @"C:\SSIS\blaSifreTakip\";
                    vars["OutputFolder"].Value = string.Format(filePathTemplate + "\\{0}", folderName);
                    vars["SelectSQLQuery"].Value = "select sifre from " + tableName + " where  Id>" + minId + "  And Id<=" + maxId + " order by Id";
                    vars["StartRowIndex"].Value = minId;
                    vars["TableName"].Value = tableName;


                    pkgResults = pkg.Execute(null, vars, null, null, null);

                    if (pkgResults == DTSExecResult.Success)
                    {
                        PasswordPackDataInfoEntity pp = new PasswordPackDataInfoEntity(Convert.ToInt32(Id));
                        pp.Status = 2;
                        pp.Save();

                        return "Success";
                    }


                }
                else
                {
                    return "Empty";
                }

            }

            return "";

        }
        catch (DtsException e)
        {

            return e.Message.ToString();
        }

    }
公共类blaService:IblaService
{
[网络方法]
[WebGet(UriTemplate=“runSSISPackage/{Id}”)]
公共字符串运行包(字符串Id)
{
尝试
{
字符串pkgLocation=ConfigurationManager.AppSettings[“dtsxPath”].ToString();
包装;
应用程序;
DTSECRESULT pkgResults;
变量变量;
字符串databaseName、tableName、minId、maxId、sCreatedDateTime、filePathTemplate、folderName;
Int64 fileRowAmount,fileCount;
使用(SqlConnection SqlConnection=newsqlconnection(ConfigurationManager.ConnectionStrings[“ConnectionString.SQL服务器(SqlClient)”)。ConnectionString.ToString())
{
sqlConnection.Open();
SqlCommand SqlCommand=newsqlcommand(“从dbo.Table中选择*,其中Id=“+Convert.ToInt32(Id),sqlConnection”);
sqlCommand.CommandTimeout=0;
SqlDataReader=sqlCommand.ExecuteReader();
if(reader.Read())
{
databaseName=读取器[“databaseName”].ToString();
tableName=reader[“tableName”].ToString();
minId=reader[“MinimumId”].ToString();
maxId=reader[“MaximumId”].ToString();
fileRowAmount=Int64.Parse(读卡器[“fileRowAmount”].ToString());
fileCount=Int64.Parse(读卡器[“fileCount”].ToString());
sCreatedDateTime=Convert.ToDateTime(读卡器[“CreatedDateTime”]).ToString(“yyyyMMddHHmmss”);
filePathTemplate=ConfigurationManager.AppSettings[“outputFilePath”].ToString();
folderName=“bla_uu3;”+sCreatedDateTime;
如果(!Directory.Exists(string.Format(filePathTemplate+“\\{0}”,folderName)))
{
CreateDirectory(string.Format(filePathTemplate+“\\{0}”,folderName));
}
app=新应用程序();
pkg=app.LoadPackage(pkgLocation,null);
变量=包装变量;
vars[“DBName”].Value=“bla_PasswordPool”;
变量[“FileCount”]。值=FileCount;
vars[“FileName”].Value=“bla_u3;”+sCreatedDateTime+“1of1.txt”;
vars[“filenameprifix”].Value=“bla_u“+sCreatedDateTime+”;
变量[“FileRowAmount”]。值=FileRowAmount;
变量[“i”]。值=0;
//vars[“OutputFolder”]。值=@“C:\SSIS\blaSifreTakip\”;
vars[“OutputFolder”].Value=string.Format(filePathTemplate+“\\{0}”,folderName);

vars[“SelectSQLQuery”].Value=“select sifre from”+tableName+,其中Id>“+minId+”和Id这通常是IIS和SQL Server(SSIS引擎)之间的权限问题。
在IIS中,查看您的WCF应用程序(IIS文件夹)正在使用的应用程序池。如果它在默认池中,请创建一个新池并分配一个实用程序帐户(以简化和隔离)。该帐户需要从(配置的)SSIS包文件夹读取文件的权限,并且需要对目标数据库的管理员权限。
下面是一条讨论线索,解释了谜题的几个部分。有点罗嗦,但非常彻底: