sql server replication:
Hi All,
I'm using RMO to generate the initial snapshot and all works well unless I
try to present the user with some status in a winform application. The
GenerateSnapshot method will proceed up until the point where it starts bulk
copying data at which point I get the following error:
"The replication agent is being shut down because execution time for
status callback handlers has exceeded the system limit of 30 seconds, one
of the callback handlers may be accessing functionalities in the
replication
agent that are locked out while the agent is running."
Below is the code I use.
Thank you,
Rhett
public void GenerateSnapshot()
{
SnapshotGenerationAgent agent;
try
{
// Set the required properties for Snapshot Agent.
agent = new SnapshotGenerationAgent();
agent.Distributor = "DistributerName";
agent.DistributorSecurityMode = SecurityMode.Standard;
agent.DistributorLogin = "UserName";
agent.DistributorPassword = "Password";
agent.Publisher = "PublisherName";
agent.PublisherSecurityMode = SecurityMode.Standard;
agent.PublisherLogin = "UserName";
agent.PublisherPassword = "Password";
agent.Publication = "pubName";
agent.PublisherDatabase = "pubDbName";
agent.ReplicationType = ReplicationType.Merge;
agent.Status += new AgentCore.StatusEventHandler(agent_Status);
// Start the agent synchronously.
agent.GenerateSnapshot();
}
catch (Exception ex)
{
// Implement custom application error handling here.
throw new ApplicationException(String.Format(
"A snapshot could not be generated for the {0} publication."
, publicationName), ex);
}
}
void agent_Status(object sender, StatusEventArgs e)
{
safeStatus.Text = e.Message;
progressBar1.Value = Int32.Parse(e.PercentCompleted.ToString());
Application.DoEvents();
}