我有一个调用 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();
}
}