0

我有一个调用 ssis 的 Web 服务,在 localhost 上没有问题。但是当我部署它时,它不会运行并且不会给出任何错误。我应该在哪里更改以允许来自远程的请求?我相信有些东西阻止了请求......这是我的代码。

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();
        }

    }
4

1 回答 1

1

这通常是 IIS 和 SQL Server(SSIS 引擎)之间的权限问题。
在 IIS 中,查看您的 WCF 应用程序(IIS 文件夹)正在使用的应用程序池。如果它在默认池中,请创建一个新池并分配一个实用程序帐户(以使事情更容易和隔离)。该帐户需要从您的(配置的)SSIS 包文件夹中读取文件的权限,并且需要目标数据库的管理员权限。
这是一个讨论线程,它解释了这个难题的几个部分。这有点罗嗦,但非常彻底:http ://social.msdn.microsoft.com/forums/en-US/sqlintegrationservices/thread/ff441dc3-b43b-486b-8be1-00126cf53812/

于 2013-05-21T16:30:50.050 回答