我使用ASP.NET WebAPI從頭構建文件服務支持WebDAV協議。第一步是響應來自WebDAV客戶端的OPTIONS請求(在這種情況下,我使用MS Office 2010)。當獲得該請求時,我的服務將返回這些信息(由Fiddle 2捕獲)。該服務在IIS服務器下運行。構建WebDAV服務器
該服務允許微軟Office中打開該文件,在這個網址:https://fileservice.domain.com/api/OfficeClient?dir=C:\測試\ WebApi.docx
HTTP/1.1 200 OK
Allow: COPY,DELETE,GET,HEAD,LOCK,MOVE,OPTIONS,POST,PROPFIND,PROPPATCH,PUT,REPORT,UNLOCK
Content-Length: 0
Accept-Ranges: bytes
Server: Microsoft-IIS/7.5
Access-Control-Allow-Origin: *
Access-Control-Allow-Credentials: true
Access-Control-Allow-Methods: ACL, CANCELUPLOAD, CHECKIN, CHECKOUT, COPY, DELETE, GET, HEAD, LOCK, MKCALENDAR, MKCOL, MOVE, OPTIONS, POST, PROPFIND, PROPPATCH, PUT, REPORT, UNCHECKOUT, UNLOCK, UPDATE, VERSION-CONTROL
Access-Control-Allow-Headers: Overwrite, Destination, Content-Type, Depth, User-Agent, Translate, Range, Timeout, X-File-Size, X-Requested-With, If-Modified-Since, X-File-Name, Cache-Control
Access-Control-Max-Age: 2147483647
DAV: 1
Public: COPY, DELETE, GET, HEAD, LOCK, MOVE, OPTIONS, POST, PROPFIND, PROPPATCH, PUT, REPORT, UNLOCK
MS-Author-Via: DAV
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Wed, 29 May 2013 04:36:19 GMT
的問題是,微軟Office不斷髮出5相同的選項請求。它應該發送的下一個請求應該是HEAD,然後是一系列其他打開文檔的方法。 我看看:http://sourceforge.net/projects/webdav/?source=navbar的實現。並嘗試從http://www.webdavsystem.com/server/運行演示並查看小提琴。但我無法在我的示例和在線演示中找到任何差異。