RavenDB Errors with NServiceBus 4.0

安稳与你 提交于 2019-12-22 05:33:28

问题


I've downloaded and installed NServiceBus 4.0, but I'm having some difficulty when the bus starts up...

2013-09-18 15:53:40,887 [1] WARN NServiceBus.Persistence.Raven.RavenUserInstall er [(null)] <(null)> - Failed to add user to raven. Processing will continue System.MissingMethodException: Method not found: 'Raven.Abstractions.Data.PutRes ult Raven.Client.Connection.IDatabaseCommands.Put(System.String, System.Nullable `1, Raven.Json.Linq.RavenJObject, Raven.Json.Linq.RavenJObject)'. at NServiceBus.Persistence.Raven.RavenUserInstaller.AddUserToDatabase(String identity, DocumentStore documentStore) at NServiceBus.Persistence.Raven.RavenUserInstaller.Install(String identity) in c:\BuildAgent\work\d4de8921a0aabf04\src\NServiceBus.Core\Persistence\Raven\Ra venUserInstaller.cs:line 40

also when I try to persist changes to the document store...

 public class RavenUnitOfWork: IManageUnitsOfWork
    {
        public IDocumentSession Session { get; set; }
        public void Begin()
        {

        }

        public void End(Exception ex = null)
        {
            if (ex == null && Session != null)
            {
                Console.WriteLine("Saving Changes to DB.");
                 Session.SaveChanges();
            }
        }
    }

produces


    2013-09-18 15:57:38,007 [13] INFO  NServiceBus.Unicast.Transport.TransportReceiv
    er [(null)] <(null)> - Failed to process message
    System.InvalidOperationException: Url: "/bulk_docs"

    System.FormatException: Guid should contain 32 digits with 4 dashes (xxxxxxxx-xx
    xx-xxxx-xxxx-xxxxxxxxxxxx).
       at System.Guid.GuidResult.SetFailure(ParseFailureKind failure, String failure
    MessageID, Object failureMessageFormatArgument, String failureArgumentName, Exce
    ption innerException)
       at System.Guid.TryParseGuidWithDashes(String guidString, GuidResult& result)
       at System.Guid.TryParseGuid(String g, GuidStyles flags, GuidResult& result)
       at System.Guid..ctor(String g)
       at Raven.Database.Server.AbstractRequestResponder.GetRequestTransaction(IHttp
    Context context)
       at Raven.Database.Server.Responders.DocumentBatch.Respond(IHttpContext contex
    t)
       at Raven.Database.Server.HttpServer.DispatchRequest(IHttpContext ctx)
       at Raven.Database.Server.HttpServer.HandleActualRequest(IHttpContext ctx)
     ---> System.Net.WebException: The remote server returned an error: (500) Intern
    al Server Error.
       at System.Net.HttpWebRequest.GetResponse()
       at Raven.Client.Connection.HttpJsonRequest.ReadJsonInternal(Func`1 getRespons
    e) in c:\Builds\RavenDB-Stable\Raven.Client.Lightweight\Connection\HttpJsonReque
    st.cs:line 340
       --- End of inner exception stack trace ---
       at NServiceBus.Unicast.Transport.TransportReceiver.ProcessMessage(TransportMe
    ssage message) in c:\BuildAgent\work\d4de8921a0aabf04\src\NServiceBus.Core\Unica
    st\Transport\TransportReceiver.cs:line 357
       at NServiceBus.Unicast.Transport.TransportReceiver.TryProcess(TransportMessag
    e message) in c:\BuildAgent\work\d4de8921a0aabf04\src\NServiceBus.Core\Unicast\T
    ransport\TransportReceiver.cs:line 235
       at NServiceBus.Transports.Msmq.MsmqDequeueStrategy.ProcessMessage(TransportMe
    ssage message) in c:\BuildAgent\work\d4de8921a0aabf04\src\NServiceBus.Core\Trans
    ports\Msmq\MsmqDequeueStrategy.cs:line 262
       at NServiceBus.Transports.Msmq.MsmqDequeueStrategy.Action() in c:\BuildAgent\
    work\d4de8921a0aabf04\src\NServiceBus.Core\Transports\Msmq\MsmqDequeueStrategy.c
    s:line 197
    2013-09-18 15:57:38,129 [29] INFO  NServiceBus.Unicast.Transport.TransportReceiv
    er [(null)] <(null)> - Failed to process message
    System.InvalidOperationException: Url: "/bulk_docs"

    System.FormatException: Guid should contain 32 digits with 4 dashes (xxxxxxxx-xx
    xx-xxxx-xxxx-xxxxxxxxxxxx).
       at System.Guid.GuidResult.SetFailure(ParseFailureKind failure, String failure
    MessageID, Object failureMessageFormatArgument, String failureArgumentName, Exce
    ption innerException)
       at System.Guid.TryParseGuidWithDashes(String guidString, GuidResult& result)
       at System.Guid.TryParseGuid(String g, GuidStyles flags, GuidResult& result)
       at System.Guid..ctor(String g)
       at Raven.Database.Server.AbstractRequestResponder.GetRequestTransaction(IHttp
    Context context)
       at Raven.Database.Server.Responders.DocumentBatch.Respond(IHttpContext contex
    t)
       at Raven.Database.Server.HttpServer.DispatchRequest(IHttpContext ctx)
       at Raven.Database.Server.HttpServer.HandleActualRequest(IHttpContext ctx)
     ---> System.Net.WebException: The remote server returned an error: (500) Intern
    al Server Error.
       at System.Net.HttpWebRequest.GetResponse()
       at Raven.Client.Connection.HttpJsonRequest.ReadJsonInternal(Func`1 getRespons
    e) in c:\Builds\RavenDB-Stable\Raven.Client.Lightweight\Connection\HttpJsonReque
    st.cs:line 340
       --- End of inner exception stack trace ---
       at NServiceBus.Unicast.Transport.TransportReceiver.ProcessMessage(TransportMe
    ssage message) in c:\BuildAgent\work\d4de8921a0aabf04\src\NServiceBus.Core\Unica
    st\Transport\TransportReceiver.cs:line 357
       at NServiceBus.Unicast.Transport.TransportReceiver.TryProcess(TransportMessag
    e message) in c:\BuildAgent\work\d4de8921a0aabf04\src\NServiceBus.Core\Unicast\T
    ransport\TransportReceiver.cs:line 235
       at NServiceBus.Transports.Msmq.MsmqDequeueStrategy.ProcessMessage(TransportMe
    ssage message) in c:\BuildAgent\work\d4de8921a0aabf04\src\NServiceBus.Core\Trans
    ports\Msmq\MsmqDequeueStrategy.cs:line 262
       at NServiceBus.Transports.Msmq.MsmqDequeueStrategy.Action() in c:\BuildAgent\
    work\d4de8921a0aabf04\src\NServiceBus.Core\Transports\Msmq\MsmqDequeueStrategy.c
    s:line 197
    2013-09-18 15:57:38,262 [30] INFO  NServiceBus.Unicast.Transport.TransportReceiv
    er [(null)] <(null)> - Failed to process message
    System.InvalidOperationException: Url: "/bulk_docs"

I've configured Raven as follows:

   Configure.Instance.Configurer.ConfigureComponent<IDocumentStore>(() =>
            {
                var store = new DocumentStore
                    {
                        Url = "" // <-- Points to my machine at port 8080
                    };
                store.Initialize();
                store.JsonRequestFactory.DisableRequestCompression = true;
                return store;
            }, DependencyLifecycle.SingleInstance);

        Configure.Instance.Configurer.ConfigureComponent<IDocumentSession>(() => { return Configure.Instance.Builder.Build<IDocumentStore>().OpenSession(); }, DependencyLifecycle.InstancePerUnitOfWork);
        Configure.Instance.Configurer.ConfigureComponent<RavenUnitOfWork>(DependencyLifecycle.InstancePerUnitOfWork);

What am I missing here?

Thanks.


回答1:


It's a known issue. See #1518. It's been fixed in #1551, but hasn't yet made it into a release. Either try building yourself from source, or wait for it to be included in a release.




回答2:


Please make sure you are running Raven v2.
Raven v2.5 has not been tested against NServiceBus v4!




回答3:


I fixed the MissingMethodException I was getting when using Raven Client 2.5 and NServiceBus 4.4.2 by adding an assembly binding redirect

  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Raven.Client.Lightweight" publicKeyToken="37f41c7f99471593" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-2.5.0.0" newVersion="2.5.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>


来源:https://stackoverflow.com/questions/18881420/ravendb-errors-with-nservicebus-4-0

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!