我已经写了一个与远程服务器同步文件的程序。但是我找不到一种方法来传递服务器的用户名和密码。我已经提供了下面的代码。它在两个本地目录之间工作。我在这里使用了微软的同步框架。但我无法将其修改为与远程服务器一起使用,即使在搜索了几天的解决方案后也是如此。有没有人可以让我知道在这里加入凭证的方法。提前感谢
string RemoteserverPath = "https://xxx.xxx.xxx.xxx.com/login/login.jsp";
string ClientPath = "E:/test";
try
{
FileSyncOptions options = FileSyncOptions.ExplicitDetectChanges |
FileSyncOptions.RecycleDeletedFiles | FileSyncOptions.RecyclePreviousFileOnUpdates | FileSyncOptions.RecycleConflictLoserFiles;
FileSyncScopeFilter filter = new FileSyncScopeFilter();
filter.FileNameExcludes.Add("*.lnk"); // Exclude all *.lnk files
DetectChangesOnFileSystemReplica(
RemoteserverPath, filter, options);
DetectChangesOnFileSystemReplica(
ClientPath, filter, options);
// Sync in both directions
SyncFileSystemReplicasOneWay(RemoteserverPath, ClientPath, null, options);
SyncFileSystemReplicasOneWay(ClientPath, RemoteserverPath, null, options);
MessageBox.Show("Done");
}
catch (Exception e1)
{
MessageBox.Show("\nException from File Sync Provider:\n" + e1.ToString());
}发布于 2014-11-10 07:07:20
您不能使用Microsoft Sync Framework来同步这样的ftp(远程)文件。必须使用代理提供程序(如WCF)才能与Microsoft Sync Framework同步
发布于 2016-06-19 18:38:18
正如hubeybozkul在他的回答中所描述的那样,我们必须让proxy或web service负责传输日期以及同步框架所需的其他操作
经过长时间的搜索,我终于找到了这样做的porjects
https://stackoverflow.com/questions/20187642
复制相似问题