同步脱机文件 [英] Syncing offline files

查看:98
本文介绍了同步脱机文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我配置了我的Windows 7计算机(计算机2)以进行脱机文件同步,以同步来自的内容网络共享。


我创建了一个共享(testshare) )在机器1上(它也是Windows 7)并且在该共享中有一个结构化存储文件(名称:a.ext) 我从机器2连接到共享(通过映射网络
驱动器),右键单击共享(例如V:驱动器)并设置为"始终可脱机使用"。该文件已同步,我可以在同步中心中看到文件a.ext。


在我的应用程序中,我以编程方式执行以下操作:


a)我在共享上访问此网络文件a.ext,打开根存储(LPSTORAGE)进行写访问,然后更改根存储,然后提交到磁盘。


b)创建了一个新的结构化存储文件(b.ext )在我的机器上的%temp%文件夹中2.打开根存储器进行写访问,然后使用api IStorage :: CopyTo()
(从a.ext到b.ext)复制存储内容,然后将存储提交到磁盘。这一步纯粹是为了压缩磁盘上的文件。


c)现在,我通过调用DeleteFile()api删除了文件a.ext,然后使用MoveFile()api将b.ext文件移动到a.ext文件,以便将压缩文件保存到磁盘。


问题是: 有时我看到共享网络位置的a.ext文件立即更新,有时文件
a.ext丢失但是当我点击同步中心查看我的离线文件时,我可以看到该文件。网络UP / online时,共享网络文件应该立即更新。

解决方案

我认为这是一个Sync配置问题,而不是开发问题。 


我认为以下配置说明将为您提供一些线索:


http://blogs.technet.com/b/netro/archive/2010 /04/09/how-the-synchronization-in-windows-7-offline-files-works.aspx  


http://technet.microsoft.com/en-us/library/ff633429(v=ws.10).aspx  


http://technet.microsoft.com/en-us/library/cc749449(WS.10).aspx#BKMK_Optimized


I configured my Windows 7 machine(machine 2) for offline file synchronization to synchronize content from network shares.

I created a share(testshare) on machine 1(it is windows 7 as well) and have one structured storage file(name: a.ext) in that share. I connected to the share(via mapped network drive) from machine 2, right click on the share (say V: drive) and set to "Always available offline". The file is synced and I can see the file a.ext in the Sync Center.

In my application, I programmatically do the following:

a)I access this network file a.ext on share, Open the root storage(LPSTORAGE) for write access and then make changes to the root storage and then commit to disk.

b)Created a new structured storage file(b.ext) in the %temp% folder on my machine 2. Open the root storage for write access, and then copied the storage content using api IStorage::CopyTo() (from a.ext to b.ext) and then committed the storage to disk. This step is purely to compress the file on disk.

c)Now, I deleted file a.ext via call DeleteFile() api and then used MoveFile() api to move the b.ext file to a.ext file so that the compressed file is saved to disk.

The issue is:Sometimes I see the a.ext file at the shared network location updating immediately and sometimes the file a.ext is missing but I can see the file when I click on View my offline files from Sync center. The shared network file SHOULD always update immediately when the network is UP/online.

解决方案

I think this would be a Sync configuration problem, instead of a dev issue. 

And I think the following configuration explanation will give your some clues:

http://blogs.technet.com/b/netro/archive/2010/04/09/how-the-synchronization-in-windows-7-offline-files-works.aspx 

http://technet.microsoft.com/en-us/library/ff633429(v=ws.10).aspx 

http://technet.microsoft.com/en-us/library/cc749449(WS.10).aspx#BKMK_Optimized


这篇关于同步脱机文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆