远程服务器文件夹

远程服务器文件夹

本文介绍了FileSyncProvider - 远程服务器文件夹(在Internet上)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道Microsoft Sync Framework(FileSyncProvider)是否可以与Internet上的远程服务器文件夹进行同步。我知道它适用于网络中的机器或位置。但是我想知道它是否适用于偏远地区
在互联网上

I want to know if Microsoft Sync Framework (FileSyncProvider) can do the syncronization with a remote server folder on internet. I know it works for the machines or locations within the network. But i want to know if it works across remote locations on internet

问题

1)建立的方法是什么?连接到互联网上的远程服务器文件夹然后启动同步?我知道它在网络中工作(通过使用NetworkCredential& NetworkConnection类)但是对于互联网我不确定

1) What is the approach to establish a connection to the remote server folder on internet and then kickoff sync? I know it work within the network (by using NetworkCredential & NetworkConnection classes) but for internet i am not sure

2)假设以下源代码中的replica1RootPath是互联网上的远程服务器文件夹,它可以采用以下任何一种路径并连接

a) 

a) \\ServerName\foldername

b) 

b)  \\Publice IP\foldername

c) http:// Public IP / foldername

源代码

Source code

string

 

replica1RootPath = System.Configuration。 ConfigurationManager .AppSettings [ " ServerSharedFolderPath"

replica1RootPath = System.Configuration.ConfigurationManager.AppSettings["ServerSharedFolderPath"

];

];

 

string
replica2RootPath = System.Configuration。
ConfigurationManager .AppSettings [ " LocalSystemFolderPath"

string replica2RootPath = System.Configuration.ConfigurationManager.AppSettings["LocalSystemFolderPath"

];

 

尝试

{

 

FileSyncOptions
options =
FileSyncOptions 。无
|
FileSyncOptions 。ExplicitDetectChanges
|
FileSyncOptions .RecycleDeletedFiles
|
FileSyncOptions .RecyclePreviousFileOnUpdates
|
FileSyncOptions .RecycleConflictLoserFiles
|
FileSyncOptions

FileSyncOptions options = FileSyncOptions.None | FileSyncOptions.ExplicitDetectChanges | FileSyncOptions.RecycleDeletedFiles | FileSyncOptions.RecyclePreviousFileOnUpdates | FileSyncOptions.RecycleConflictLoserFiles | FileSyncOptions

。CompareFileStreams;

.CompareFileStreams;

 

FileSyncScopeFilter
filter =
new
FileSyncScopeFilter

FileSyncScopeFilter filter = newFileSyncScopeFilter

();

();

DetectChangesOnFileSystemReplica_Server(replica1RootPath,filter,options);

DetectChangesOnFileSystemReplica_Server(replica1RootPath, filter, options);

DetectChangesOnFileSystemReplica(replica2RootPath,filter,options );

DetectChangesOnFileSystemReplica(replica2RootPath, filter, options);

currentContent =

currentContent =

""

""

;

;

SyncFileSystemReplicasOneWay(replica1RootPath,replica2RootPath,filter,options);

SyncFileSystemReplicasOneWay(replica1RootPath, replica2RootPath, filter, options);

 

}

}

 

catch 例外

catch(Exception

ex)

ex)

{

System.Windows。

System.Windows.

MessageBox 。显示( " \ nException来自文件同步提供商的
:\ n"

MessageBox.Show("\nException from File Sync Provider:\n"

+ ex.ToString());

+ ex.ToString());

}


如果您需要更多详细信息,请通知我

Please let me know if you need any more details

推荐答案

 

谢谢

Yunwen


这篇关于FileSyncProvider - 远程服务器文件夹(在Internet上)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-12 22:38