使用 .NET WebRequest 将文件上传到共享点时出现 409/Conflict HTTP 错误的原因? [英] Reasons for a 409/Conflict HTTP error when uploading a file to sharepoint using a .NET WebRequest?

查看:37
本文介绍了使用 .NET WebRequest 将文件上传到共享点时出现 409/Conflict HTTP 错误的原因?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个方法,它使用 WebRequest 将文件上传到 sharepoint 2010 列表/文件夹,使用 PUT 请求,并将 Overwrite Header 设置为 T(覆盖).

I've got a method that uses a WebRequest to upload a file to a sharepoint 2010 list/folder, using a PUT request, with the Overwrite Header set to T (overwrite).

上传多个文件时(多次调用该方法),某些请求会失败并显示 409 Conflict HTTP 错误.

When several files are uploaded (method is called several times), some requests fail with a 409 Conflict HTTP error.

我用谷歌搜索过,似乎最常见的原因是试图影响/更新不存在的文件(例如将请求 URL 设置为没有文件名的路径).然而,事实并非如此.如果冲突与已经存在的文件有关,我添加了代码以在上传之前物理删除文件,但我仍然收到一些 409.

I've googled, and it seems the most common reason is trying to affect/update a file that does not exist (like setting the request URL to a path without a file name). However, that is not the case. In case the conflict had something to do with the file already existing, I added code to physically delete the file before uploading it, and i'm still getting some 409's.

有没有人收到过这种类型的错误,如果有,你能告诉我你是如何修复它的以及根本原因是什么吗?任何帮助是极大的赞赏.谢谢

Has anyone received this type of error, and if so, can you tell me how you fixed it and what was the root cause? Any help is greatly appreciated. Thanks

推荐答案

由于没有发布任何答案,我找到了以下 此处:

Since no answers were posted, I found the following here:

Web 服务器(运行网站)认为客户端(例如您的 Web 浏览器或我们的 CheckUpDown 机器人)提交的请求无法完成,因为它与某些已经建立的规则相冲突.例如,如果您尝试将一个文件上传到 Web 服务器,而该文件比已经存在的文件旧,则您可能会收到 409 错误 - 导致版本控制冲突.

The Web server (running the Web site) thinks that the request submitted by the client (e.g. your Web browser or our CheckUpDown robot) can not be completed because it conflicts with some rule already established. For example, you may get a 409 error if you try to upload a file to the Web server which is older than the one already there - resulting in a version control conflict.

有人在类似的问题就在 stackoverflow 上,答案是:

我在引用文档的 url 时遇到了这个问题库而不是目标文件本身.

I've had this issue when I was referencing the url of the document library and not the destination file itself.

即试试http://服务器名称/文档库名称/新文件名.doc

但是我 100% 确定这不是我的情况,因为我多次检查了 WebRequest 的 URI 属性并且 URI 是完整的文件名,并且路径中的所有文件夹都存在于共享点站点上.

However I am 100% sure this was not my case, since I checked the WebRequest's URI property several times and the URI was complete with filename, and all the folders in the path existed on the sharepoint site.

无论如何,我希望这对某人有所帮助.

Anyways, I hope this helps someone.

这篇关于使用 .NET WebRequest 将文件上传到共享点时出现 409/Conflict HTTP 错误的原因?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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