July 4, 2008 at 1:50 am
Hi all,
I've a great problem that struggle me since a week...this is the scenario: I've a SQL Server 2005 as Publisher and Distributor and hundreds of client connected with XP Pro, a local SQL Server Express 2005 and a simple command line program in RMO to run a web merge replica some times during the day. In this scenario all works fine for months: now I've implemented a new version with a simple program in vb.net, a windows service and the merge agent in RMO.
The code of the agent is this (I copy only the more working function)
Public Function StartTransmission() As Boolean
Dim retval As Boolean = False
Dim sw As StreamWriter
InitLog()
' Create a connection to the Subscriber.
Dim conn As ServerConnection = New ServerConnection(_subscriberName)
conn.LoginSecure = False
conn.Login = _SQLExpressUserName
conn.Password = _SQLExpressPassword
Dim subscription As MergePullSubscription
Dim agent As MergeSynchronizationAgent
sw = File.AppendText(LogFile)
Try
sw.WriteLine("---- START TRANSMISSION ----")
' Connect to the Subscriber.
conn.Connect()
' Define the pull subscription.
subscription = New MergePullSubscription()
subscription.ConnectionContext = conn
subscription.DatabaseName = _subscriptionDbName
subscription.PublisherName = _publisherName
subscription.PublicationDBName = _publicationDbName
subscription.PublicationName = _publicationName
subscription.HostName = _hostUserName
' If the pull subscription exists, then start the synchronization.
If subscription.LoadProperties() Then
' Check that we have enough metadata to start the agent.
If Not subscription.PublisherSecurity Is Nothing Or subscription.DistributorSecurity Is Nothing Then
agent = subscription.SynchronizationAgent
agent.OutputVerboseLevel = 1
agent.Output = LogFile
agent.SubscriberSecurityMode = SecurityMode.Standard
agent.SubscriberLogin = _SQLExpressUserName
agent.SubscriberPassword = _SQLExpressPassword
agent.InternetTimeout = "1000"
agent.HostName = _hostUserName
' Synchronously start the Merge Agent for the subscription.
agent.Synchronize()
retval = True
Else
sw.WriteLine("There is insufficent metadata to synchronize the subscription. Recreate the subscription with the agent job or supply the required agent properties at run time.")
retval = False
End If
Else
' Do something here if the pull subscription does not exist.
sw.WriteLine(String.Format("A subscription to '{0}' does not exist on {1}", _publicationName, _subscriberName))
retval = False
End If
Catch ex As Exception
sw.WriteLine("The subscription could not be synchronized. Verify that the subscription has been defined correctly.")
sw.WriteLine("Error:" & ex.InnerException.ToString)
sw.WriteLine("Source:" & ex.Source.ToString)
sw.WriteLine("Message:" & ex.Message.ToString)
retval = False
Finally
conn.Disconnect()
sw.WriteLine("---- END TRANSMISSION ----")
sw.Flush()
sw.Close()
End Try
Return retval
End Function
So when I call "agent.Synchronize()" a error thrown with "The Proxy Auto-configuration URL was not found."...so I'm coming mad becouse I'd tryed EVERYTHING but this damned windows service doesn't run!
For more info, the service is running as Local system account...if I change the settings giving a machine local account with administration privilegies it runs!!! I've tryed to write impersonalization before running this code but the code doesn't works!!!
So...I've to run the windows service with Local system account (for my reason :D).......I've need urgent help on this problem...anyone can help me?
September 1, 2009 at 5:50 am
Hi
Whats the SQL Version you are using on both sides of replication ? Post is bit old too, is this already resolved?
thanks
Anuj
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply