Word 2010 保存到 WebDAV 服务器后报告错误
我有一个自定义的 WebDAV 服务器,使用 Sphoirum webdav 服务器构建,驻留在 ASP.NET 中MVC3应用程序。这是一个.Net 4.0 项目。
文档存储库是一个 SharePoint,我们的 MVC 应用程序是它的前端,并通过 WebDAV 公开整个内容。请注意,我们的 IIS 7.5 上没有启用 WebDAV 发布。
我已经实现了以下 HTTP 动词:
- Get
- Head
- Lock
- Options
- PropFind
- Put
- Unlock
现在,当我打开 Word 文档时,它首先处于只读模式。获得锁定并进入编辑模式是成功的,但是当我想保存文档中的更改时,我得到以下信息:
您的更改已保存,但由于错误而无法上传。
诀窍在于,文档确实正确保存到存储库中,并且我们的 WebDAV 服务器对 Word 的响应是 HTTP/200,但 Word 仍然抱怨。 我还尝试直接从 SharePoint 存储库在 Word 中进行编辑,只是为了确认我的 Office 没有以某种方式损坏 - 一切正常。
以下是从 Word 保存文档时 PUT 请求的响应:
HTTP/1.1 200 OK
Date: Tue, 06 Sep 2011 12:25:47 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
MicrosoftSharePointTeamServices: 12.0.0.6545
Last-Modified: Tue, 06 Sep 2011 12:25:47 GMT
ETag: "{F4A63494-D302-4C9B-9C57-D0CB0937A2B0},9"
ResourceTag: rt:F4A63494-D302-4C9B-9C57-D0CB0937A2B0@00000000009
X-MSDAVEXTLockTimeout: Second-3600
Lock-Token: opaquelocktoken:{F4A63494-D302-4C9B-9C57-D0CB0937A2B0}20110906T122532Z
Expires: Mon, 22 Aug 2011 12:25:47 GMT
Cache-Control: private,max-age=0
Content-Length: 0
Public-Extension: http://schemas.microsoft.com/repl-2
Set-Cookie: WSS_KeepSessionAuthenticated=40689; path=/
下面是来自我们的 WebDAV 服务器的同一文档的相同响应:
HTTP/1.1 200 OK
Cache-Control: private,max-age=0
Content-Length: 0
Expires: Wed, 24 Aug 2011 08:03:28 GMT
Last-Modified: Wed, 07 Sep 2011 08:03:28 GMT
ETag: "{4a4331a8-7df6-43e6-bd5f-bb80765e83a2},1"
Server: Microsoft-IIS/7.5
MS-Author-Via: DAV
ResourceTag: rt:4a4331a8-7df6-43e6-bd5f-bb80765e83a2@00000000001
Lock-Token: opaquelocktoken:{4a4331a8-7df6-43e6-bd5f-bb80765e83a2}20110907T080328Z
X-MSDAVEXTLockTimeout: Second-3600
Public-Extension: http://schemas.microsoft.com/repl-2
MicrosoftSharePointTeamServices: 12.0.0.6545
Set-Cookie: WSS_KeepSessionAuthenticated=40689; path=/
X-Powered-By: ASP.NET
Date: Wed, 07 Sep 2011 08:03:27 GMT
因此,我尝试模仿 SharePoint 发出的一些标头,例如 MicrosoftSharePointTeamServices em> 但无济于事。
I've got a custom WebDAV server, built using Sphoirum webdav server, that resides inside an ASP.NET MVC3 application. It's a .Net 4.0 project.
The document repository is a SharePoint, where our MVC application is a front end to it, and exposes the whole thing via the WebDAV. Just to note we don't have WebDAV publishing enabled on our IIS 7.5.
I've implemented the following HTTP verbs:
- Get
- Head
- Lock
- Options
- PropFind
- Put
- Unlock
Now, when I open a word document, it's first in the read only mode. Getting the lock and into edit mode is successful, but when I want to save the changes in my document I get the following:
Your changes were saved but could not be uploaded because of an error.
The trick is that document is indeed saved correctly to the repository, and the response from our WebDAV server to word is HTTP/200 but the Word complains nonetheless.
I've also tried editing in Word directly from the SharePoint repository, just to confirm that my Office isn't broken somehow - all works.
Here's the response from PUT request when saving the document from Word:
HTTP/1.1 200 OK
Date: Tue, 06 Sep 2011 12:25:47 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
MicrosoftSharePointTeamServices: 12.0.0.6545
Last-Modified: Tue, 06 Sep 2011 12:25:47 GMT
ETag: "{F4A63494-D302-4C9B-9C57-D0CB0937A2B0},9"
ResourceTag: rt:F4A63494-D302-4C9B-9C57-D0CB0937A2B0@00000000009
X-MSDAVEXTLockTimeout: Second-3600
Lock-Token: opaquelocktoken:{F4A63494-D302-4C9B-9C57-D0CB0937A2B0}20110906T122532Z
Expires: Mon, 22 Aug 2011 12:25:47 GMT
Cache-Control: private,max-age=0
Content-Length: 0
Public-Extension: http://schemas.microsoft.com/repl-2
Set-Cookie: WSS_KeepSessionAuthenticated=40689; path=/
And here's the same response, for the same document, from our WebDAV server:
HTTP/1.1 200 OK
Cache-Control: private,max-age=0
Content-Length: 0
Expires: Wed, 24 Aug 2011 08:03:28 GMT
Last-Modified: Wed, 07 Sep 2011 08:03:28 GMT
ETag: "{4a4331a8-7df6-43e6-bd5f-bb80765e83a2},1"
Server: Microsoft-IIS/7.5
MS-Author-Via: DAV
ResourceTag: rt:4a4331a8-7df6-43e6-bd5f-bb80765e83a2@00000000001
Lock-Token: opaquelocktoken:{4a4331a8-7df6-43e6-bd5f-bb80765e83a2}20110907T080328Z
X-MSDAVEXTLockTimeout: Second-3600
Public-Extension: http://schemas.microsoft.com/repl-2
MicrosoftSharePointTeamServices: 12.0.0.6545
Set-Cookie: WSS_KeepSessionAuthenticated=40689; path=/
X-Powered-By: ASP.NET
Date: Wed, 07 Sep 2011 08:03:27 GMT
So I've tried to mimic some of the headers SharePoint emits, like MicrosoftSharePointTeamServices but to no avail.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
顺便说一句,我在 Sphorium webdav 中发现了导致此问题的错误。该错误存在于 DavLockBase_InternalProcessDavRequest() 方法中,错误的代码行是:
应该是: 进行
更改后,在 Word 2010 中保存文件工作正常。
By the way, I found the bug in Sphorium webdav that was causing this. The bug was in the method DavLockBase_InternalProcessDavRequest() and the incorrect line of code was:
which should be:
After that change, saving files in Word 2010 worked fine.
如果有人再次遇到这个问题,这里有一个基于上述答案以及我在使用 word 2010 时发现的内容构建的修复程序。基本上,该修复程序涉及替换“DavLockBase_InternalProcessDavRequest”方法的代码(我已经为每个“更正”添加了一些评论)。
作为注释(在此处找到一些信息):word 2010 的 webdav 实现的行为有所不同客户端是否安装了补丁;因此,并非在所有情况下都需要第三次更正!
希望有帮助!
If someone ever runs into this again, here is a fix that was built based on the above answer, and on what I have found from working with word 2010. Basically the fix involves replacing the code for the "DavLockBase_InternalProcessDavRequest" method (I've added some comments for each "correction").
As a note (found some info here): the behavior of the webdav implementation for word 2010 differs on whether there is a patch installed on the client side or not; therefore the 3rd correction may not be needed in all cases!
Hope it helps!
观察:锁定令牌使用无效语法(Sharepoints 也是如此)。还;大多数这些标头不需要(专有)或不适用于 PUT 响应(例如 Lock-Token)。
我建议首先尝试使用 mod_dav 发布到 Apache,并观察 HTTP 交换。
Observation: the lock token uses an invalid syntax (so does Sharepoints). Also; most of these headers shouldn't be needed (being proprietary) or do not apply to a PUT response (such as Lock-Token).
I would recommend to try publishing to Apache with mod_dav first, and to observe the HTTP exchange.