1

我使用全新的干净 RavenDB 安装发起的每个 POST 请求都会不断收到 HTTP 409 错误。我在我的 Windows 7 64 位开发工作站上提取了 build 960(超过了推荐的最低系统要求)。我的配置包含在下面。我通过运行 Start.cmd 来启动服务器。在服务器运行时,我从 RavenDB 网站的 HTTP API 文档中复制粘贴 CURL 命令并运行它,但我收到 HTTP 代码 409 错误。除了设置适当的匿名访问之外,我还没有找到任何关于适当处理此错误的说明或用于显式配置的特殊说明。我也看到了从其他工作站运行相同的服务器设置并使用其他客户端(Ruby rest-client gem)的同样问题。

配置

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <appSettings>
    <add key="Raven/Port" value="*"/>
    <add key="Raven/DataDir" value="~\Data"/>
    <add key="Raven/AnonymousAccess" value="All"/>
    <add key="Raven/RunInMemory" value="true"/>
  </appSettings>
    <runtime>
        <loadFromRemoteSources enabled="true"/>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
            <probing privatePath="Analyzers"/>
        </assemblyBinding>
    </runtime>
</configuration>

命令行客户端:

C:\dev\RavenDB> curl -v -X POST http://localhost:8080/docs -d "{ FirstName: 'Bob', LastName: 'Smith', Address: '5 Elm St' }"
* timeout on name lookup is not supported
* About to connect() to localhost port 8080 (#0)
*   Trying XXX.XXX.XXX.XXX...
* connected
* Connected to localhost (XXX.XXX.XXX.XXX) port 8080 (#0)
> POST /docs HTTP/1.1
> User-Agent: curl/7.26.0
> Host: localhost:8080
> Accept: */*
> Content-Length: 60
> Content-Type: application/x-www-form-urlencoded
>
* upload completely sent off: 60 out of 60 bytes
< HTTP/1.1 409 Conflict
< Transfer-Encoding: chunked
< Server: Microsoft-HTTPAPI/2.0
< Raven-Server-Build: 960
< Date: Tue, 06 Nov 2012 19:36:35 GMT
<
{
  "Url": "/docs",
  "ActualETag": "00000000-0000-0000-0000-000000000000",
  "ExpectedETag": "213966fe-5c42-41c4-80c1-6a73c44e77d3",
  "Error": "PUT attempted on document 'ac171c38-5428-40d5-beb6-56ea006dbcf6' using a non current etag (document deleted)"
}* Connection #0 to host localhost left intact
* Closing connection #0

这是我尝试通过 Web 界面手动创建新文档时出现的错误。

Message: PUT attempted on document 'bbc8a11d-94fb-4e80-958d-4b5c74d8e8be' using a non current etag (document deleted)
Uri: /edit?mode=new&database=Default
Server Uri: unknown

-- Error Information --
Raven.Abstractions.Exceptions.ConcurrencyException: PUT attempted on document 'bbc8a11d-94fb-4e80-958d-4b5c74d8e8be' using a non current etag (document deleted)
   at Raven.Client.Silverlight.Connection.Async.AsyncServerClient.<>c__DisplayClass39.<PutAsync>b__38(Task`1 task1)
   at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()

Inner StackTrace: 
   at Raven.Studio.Infrastructure.InvocationExtensions.Catch(Task parent, Action`1 action)
   at Raven.Studio.Models.EditableDocumentModel.SaveDocumentCommand.SaveDocument()
   at Raven.Studio.Models.EditableDocumentModel.SaveDocumentCommand.Execute(Object parameter)
   at System.Windows.Controls.Primitives.ButtonBase.ExecuteCommand()
   at System.Windows.Controls.Primitives.ButtonBase.OnClick()
   at System.Windows.Controls.Button.OnClick()
   at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
   at System.Windows.Controls.Control.OnMouseLeftButtonUp(Control ctrl, EventArgs e)
   at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName, UInt32 flags)
4

1 回答 1

0

这是一个错误是 960,它不支持 POST 到 /docs 您需要对 /docs/[Guid.NewGuid()] 执行 PUT

于 2012-11-06T21:22:32.310 回答