0

我正在尝试复制 SQL CE 3.5 SP1 数据库,但在同步时,我抛出以下错误:

“使用提供的连接信息无法连接到 SQL Server。SQL Server 不存在,访问被拒绝,因为 IIS 用户不是运行 SQL Server 的计算机上的有效用户,或者密码不正确。”

我正在使用 Windows Mobile 6 Professional 模拟器,而我尝试连接的机器是运行 Windows XP Professional SP3 的 Windows 虚拟机。我已经为模拟器配置了网络适配器设置(我可以访问网页),验证了用户权限,仔细检查了 IIS 设置,并三次检查了我的连接字符串:

            SqlCeReplication rpl = null;

        try
        {
            // Creates the replication object.
            rpl = new SqlCeReplication();
            // Establishes the connection string.
            rpl.SubscriberConnectionString = @"Data Source = \Program Files\ParkSurvey\ParkSurvey.sdf; Password = *; Temp File Max Size = 512; 
            Max Database Size = 512; Max Buffer Size = 512; Flush Interval = 20; Autoshrink Threshold = 10; Default Lock Escalation = 100";
            // Sets the Publisher properties.
            rpl.PublisherSecurityMode = SecurityType.NTAuthentication;
            rpl.Publisher = "PUBLISHER";
            rpl.PublisherLogin = "INDICOPUBLIC\\subuser";
            rpl.PublisherPassword = "*";
            rpl.PublisherDatabase = "PUBLISHER";
            rpl.Publication = "ParkSurveyPublication";
            // Sets the internet replication properties.
            rpl.InternetUrl = "http://replication/sqlce/sqlcesa35.dll";
            rpl.InternetLogin = "INDICOPUBLIC\\subuser";
            rpl.InternetPassword = "*";
            rpl.ConnectionManager = true;
            // Sets the Distributor properties.
            rpl.Distributor = "PUBLISHER";
            rpl.DistributorLogin = "INDICOPUBLIC\\subuser";
            rpl.DistributorPassword = "psrAdmin";
            rpl.DistributorSecurityMode = SecurityType.NTAuthentication;
            // Sets the timeout properties.
            rpl.ConnectionRetryTimeout = 120;
            rpl.ConnectTimeout = 6000;
            rpl.ReceiveTimeout = 6000;
            rpl.SendTimeout = 6000;
            // Sets the Subscriber properties.
            rpl.Subscriber = "ParkSurveySubscriber";
            rpl.HostName = "Mobile1";
            rpl.CompressionLevel = 6;
            rpl.ExchangeType = ExchangeType.BiDirectional;
            // Call the replication methods.
            rpl.Synchronize();

        }
        catch (SqlCeException sqlEx)
        {
            MessageBox.Show(sqlEx.Message);
        }
        finally
        {
            // Disposing the replication object
            if (rpl != null)
            {
                rpl.Dispose();
            }
        }

我还尝试在移动模拟器的文件资源管理器中打开主机本身,并提示“找不到网络路径。”。这让我相信这是模拟器本身的 ActiveSync 问题。有人有建议吗?

4

1 回答 1

0

尝试使用 IP 地址而不是主机名,并从设备上的 IE 测试代理 URL。如果您的数据库服务器是 SQL 2012,请确保在所有组件上使用最新版本的 3.5 SP2

于 2012-05-09T07:34:51.203 回答