I have this code
var connectionString = "Data Source=" + servername + ";Initial Catalog=" + databasename + ";Integrated Security=True";
var connection = new SqlConnection(connectionString);
var integrationServices = new IntegrationServices(connection); // ERROR HERE. Failed to connect to server.
var package = integrationServices
.Catalogs["SSISDB"]
.Folders["MyFolder"]
.Projects["MyProject"]
.Packages["MyPackage.dtsx"];
long executionIdentifier = package.Execute(true, null);
ExecutionOperation eo = integrationServices.Catalogs["SSISDB"].Executions[executionIdentifier];
while(!eo.Completed)
{
eo.Refresh();
System.Threading.Thread.Sleep(5000);
}
During development, no error is encountered but when I web deploy it, error occurs when I instantiate integrationServices like
var integrationServices = new IntegrationServices(connection);
It is saying "Failed to connect to server". I know the error because when I console.log the error in my browser, it says so. So something is preventing me to connect my integrationservices.
Can anyone give me an idea on this? Thanks.
edited:
I already enabled allow remote connections
Looks like a case of either a bad connection string or a SQL Server which doesn't allow 1433 port connections.
do the following:
connectionString
variable value. once you have that, either it'll show as an incorrect value. (possibly because the Dts variables or the source of your servername/databasename variable values are not set) OR the Sql server is not allowing remote connections. (you need to open up the ports)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.