n 層の同期ソリューションを構築する方法を研究しています。WebSharingAppDemo-CEProviderEndToEnd サンプルからはほぼ実行可能に見えますが、何らかの理由で、クライアントがライブ SQL データベース接続を持っている場合にのみアプリが同期されます。不足しているものと、SQL をインターネットに公開せずに同期する方法を説明できますか?
私が経験している問題は、クライアントからの開いている SQL 接続を持つリレーショナル同期プロバイダーを提供すると正常に動作しますが、例のように、閉じているが構成された接続文字列を持つリレーショナル同期プロバイダーを提供すると、 、サーバーがバッチ ファイルを受信しなかったことを示すエラーが WCF から表示されます。それで、私は何を間違っていますか?
SqlConnectionStringBuilder builder = new SqlConnectionStringBuilder();
builder.DataSource = hostName;
builder.IntegratedSecurity = true;
builder.InitialCatalog = "mydbname";
builder.ConnectTimeout = 1;
provider.Connection = new SqlConnection(builder.ToString());
// provider.Connection.Open(); **** un-commenting this causes the code to work**
//create anew scope description and add the appropriate tables to this scope
DbSyncScopeDescription scopeDesc = new DbSyncScopeDescription(SyncUtils.ScopeName);
//class to be used to provision the scope defined above
SqlSyncScopeProvisioning serverConfig = new SqlSyncScopeProvisioning();
....
私が得るエラーは、WCF コードのこの部分で発生します。
public SyncSessionStatistics ApplyChanges(ConflictResolutionPolicy resolutionPolicy, ChangeBatch sourceChanges, object changeData)
{
Log("ProcessChangeBatch: {0}", this.peerProvider.Connection.ConnectionString);
DbSyncContext dataRetriever = changeData as DbSyncContext;
if (dataRetriever != null && dataRetriever.IsDataBatched)
{
string remotePeerId = dataRetriever.MadeWithKnowledge.ReplicaId.ToString();
//Data is batched. The client should have uploaded this file to us prior to calling ApplyChanges.
//So look for it.
//The Id would be the DbSyncContext.BatchFileName which is just the batch file name without the complete path
string localBatchFileName = null;
if (!this.batchIdToFileMapper.TryGetValue(dataRetriever.BatchFileName, out localBatchFileName))
{
//Service has not received this file. Throw exception
throw new FaultException<WebSyncFaultException>(new WebSyncFaultException("No batch file uploaded for id " + dataRetriever.BatchFileName, null));
}
dataRetriever.BatchFileName = localBatchFileName;
}
何か案は?