C# .Net WebDAV 服务器
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/627705/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
.Net WebDAV Server
提问by Andrew Theken
I am looking to implement a WebDAV server in ASP.Net. the app will be deployed to IIS 6. I have seen a few frameworks that provide this functionality, but I can't seem to identify how they're able to accomplish it without (apparently) modifying IIS settings.
我希望在 ASP.Net 中实现一个 WebDAV 服务器。该应用程序将部署到 IIS 6。我已经看到一些提供此功能的框架,但我似乎无法确定它们如何在不(显然)修改 IIS 设置的情况下完成它。
My specific question is how do I configure IIS and ASP.Net so that a IHttpModule/IHttpHandler might have an opportunity to handle any of the additional WebDAV verbs (i.e. LOCK, OPTIONS, PROFIND, etc.)
我的具体问题是如何配置 IIS 和 ASP.Net 以便 IHttpModule/IHttpHandler 可能有机会处理任何额外的 WebDAV 动词(即 LOCK、OPTIONS、PROFIND 等)?
采纳答案by IT Hit WebDAV
There is no way to configure WebDAV verbs in IIS 6 without modifying IIS settings. It is possible only with IIS 7 and later.
如果不修改 IIS 设置,则无法在 IIS 6 中配置 WebDAV 谓词。仅适用于 IIS 7 及更高版本。
To handle all verbs required by WebDAV in IIS 6 you will need to create an application wildacrd map. Right click on your web application in IIS 6 MMC console and go to Properties->Virtual DirectoryTab->Configuration. Click Insertto add new wildcard map.
要在 IIS 6 中处理 WebDAV 所需的所有动词,您需要创建一个应用程序通配符映射。在 IIS 6 MMC 控制台中右键单击您的 Web 应用程序,然后转到Properties-> Virtual DirectoryTab-> Configuration。单击插入以添加新的通配符映射。
- Executable - \Microsoft.NET\Framework\<.Net Framework Version>\aspnet_isapi.dll
- Verify that file exists - Unchecked
- 可执行文件 - \Microsoft.NET\Framework\<.Net Framework 版本>\aspnet_isapi.dll
- 验证文件是否存在 - 未选中
On Home Directorytab of your application properties set Execute permissionsto Scripts onlyand allow reads.
在应用程序属性的主目录选项卡上,将执行权限设置为仅脚本并允许读取。
Here is the web.config example: http://www.webdavsystem.com/server/prev/v2/documentation/hosting_iis_asp_net/webconfig_example
这是 web.config 示例:http: //www.webdavsystem.com/server/prev/v2/documentation/hosting_iis_asp_net/webconfig_example
Please note that this web.config example was specifically created and tested with ASP.NET 2.0 on IIS 6 on Server 2003 and IIS 5.1 on XP. It does not handle &, %, + and trailing dots (.).
请注意,此 web.config 示例是专门在 Server 2003 上的 IIS 6 和 XP 上的 IIS 5.1 上使用 ASP.NET 2.0 创建和测试的。它不处理 &、%、+ 和尾随点 (.)。
ASP.NET 4.x provides means for handling any special characters in your WebDAV server, configuring web.config, including &, % and '.'. The web.config that supports IIS versions 6-8 is generated by IT Hit WebDAV Server Engine Wizard.
ASP.NET 4.x 提供了处理 WebDAV 服务器中任何特殊字符、配置 web.config 的方法,包括 &、% 和 '.'。支持 IIS 版本 6-8 的 web.config 由IT Hit WebDAV Server Engine Wizard 生成。
回答by Corbin March
Check out Geoff Lane's articles on WebDAV:
查看 Geoff Lane 关于 WebDAV 的文章:
- http://www.zorched.net/2006/01/20/aspnet-web-application-without-aspx-extension/- shows configuration of verbs in IIS and HttpModule setup.
- http://www.zorched.net/2006/02/02/custom-webdav-server-using-net/
- http://www.zorched.net/2006/03/01/more-webdav-tips-tricks-and-bugs/
回答by Ira Miller
I would take a look at this project http://sourceforge.net/projects/webdav/for a webdav implementation in C#. If you must build your own it is nice to reference a completed one; even better if you can reuse it.
我会看看这个项目http://sourceforge.net/projects/webdav/在 C# 中的 webdav 实现。如果您必须构建自己的,最好参考一个完整的;如果您可以重复使用它,那就更好了。
Yes, you will need to modify IIS6 settings to support binding the ISAPI module for .NET to all request types and not checking if a file exists. There is no other way to do this on IIS6 because web dev clients on windows will do an OPTIONS request on the root (/) of the website when checking for webdav support.
是的,您需要修改 IIS6 设置以支持将 .NET 的 ISAPI 模块绑定到所有请求类型,并且不检查文件是否存在。在 IIS6 上没有其他方法可以做到这一点,因为 Windows 上的 Web 开发客户端在检查 webdav 支持时会在网站的根 (/) 上执行 OPTIONS 请求。
II7 gives you more options...
II7为您提供更多选择...