我正在尝试复制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问题。有没有人有任何建议?
答案 0 :(得分:0)
尝试使用IP地址而不是主机名,并在设备上测试IE中的代理URL。如果您的数据库服务器是SQL 2012
,请确保在所有组件上使用最新版本的3.5 SP2