在dotnet core中使用rmo在sql 2012中创建发布时出现问题

14ifxucb  于 2021-07-24  发布在  Java
关注(0)|答案(0)|浏览(184)

我正在尝试使用microsoft.sqlserver.rmo在sql server 2012中创建发布,但它在创建复制数据库时引发method not found异常。

// Connect to the Publisher.
            if (conn.IsOpen)
                conn.Disconnect();
            conn.Connect();

            // Enable the AdventureWorks2012 database for transactional publishing.
            in the below line i am getting the method not found exceptions
            publicationDb = new ReplicationDatabase(publicationDbName,conn);

            // If the database exists and is not already enabled, 
            // enable it for transactional publishing.

            if (publicationDb.LoadProperties())[enter image description here][1]
            {
                if (!publicationDb.EnabledTransPublishing)
                {
                    publicationDb.EnabledTransPublishing = true;
                }
                // If the Log Reader Agent does not exist, create it.
                if (!publicationDb.LogReaderAgentExists)
                {
                    // Specify the Windows account under which the agent job runs.
                    // This account will be used for the local connection to the 
                    // Distributor and all agent connections that use Windows Authentication.
                    publication.SnapshotGenerationAgentProcessSecurity.Login = winLogin;
                    publication.SnapshotGenerationAgentProcessSecurity.Password = winPassword;

                    // Explicitly set authentication mode for the Publisher connection
                    // to the default value of Windows Authentication.
                    publicationDb.LogReaderAgentPublisherSecurity.WindowsAuthentication = false;

                    // Create the Log Reader Agent job.
                    publicationDb.CreateLogReaderAgent();
                }
            }
            else
            {
                throw new ApplicationException(String.Format(
                    "The {0} database does not exist at {1}.",
                    publicationDb, publisherName));
            }

错误消息1错误消息2

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题