I am suffering from a big case of "it used to work". I am attempting to create an application that will programmatically set up a transactional publishing replication process on a database. I wanted to update the application, which was working 3 months ago, and I am met with an error early on while setting up the replication options, specifically enabling transactional publishing.
string connectionString =
@"Data Source=localhost;database=master;Persist Security Info=True;User Id=myUserId;Password=myPassword;";
ServerConnection serverConnection =
new ServerConnection(connectionString);
serverConnection.Connect();
ReplicationDatabase replicationDatabase =
new ReplicationDatabase("myDatabaseName", databaseConnection);
replicationDatabase.EnabledTransPublishing = true;
When I call the last line of the code above, I get the following error.
Exception thrown: 'Microsoft.SqlServer.Management.Common.ExecutionFailureException' in Microsoft.SqlServer.ConnectionInfo.dll
at Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteNonQuery(String sqlCommand, ExecutionTypes executionType)
at Microsoft.SqlServer.Replication.ReplicationObject.ExecCommand(String commandIn)
at Microsoft.SqlServer.Replication.ReplicationDatabase.set_EnabledTransPublishing(Boolean value)
The database connection is tested to be valid and working. The database user account I am using has db_owner access to master and the database that I am replicating. The user also has all server roles, including sysadmin. I appreciate any insight into this issue.