3

我有一个 NServiceBus 传奇,它试图使用 Raven 超时持久器来安排超时,但是当它尝试时它会收到此错误:

NServiceBus.Unicast.Transport.Transactional.TransactionalTransport [(null)] <(null)> - Failed raising 'transport message received' event for message with ID=90dadfbd-9eb6-4558-96ec-37edb642330a\17275422
    System.InvalidOperationException: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
    <HTML><HEAD><TITLE>Bad Request</TITLE>
    <META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii"></HEAD>
    <BODY><h2>Bad Request - Request Too Long</h2>
    <hr><p>HTTP Error 400. The size of the request headers is too long.</p>
    </BODY></HTML>
     ---> System.Net.WebException: The remote server returned an error: (400) Bad Request.
       at System.Net.HttpWebRequest.GetResponse()
       at Raven.Client.Connection.HttpJsonRequest.ReadStringInternal(Func`1 getResponse)
       --- End of inner exception stack trace ---
       at Raven.Client.Connection.HttpJsonRequest.ReadStringInternal(Func`1 getResponse)
       at Raven.Client.Connection.HttpJsonRequest.ReadResponseString()
       at Raven.Client.Connection.HttpJsonRequest.ReadResponseJson()
       at Raven.Client.Connection.ServerClient.DirectPut(RavenJObject metadata, String key, Nullable`1 etag, RavenJObject document, String operationUrl)
       at Raven.Client.Connection.ServerClient.<>c__DisplayClass10.<Put>b__f(String u)
       at Raven.Client.Connection.ServerClient.TryOperation[T](Func`2 operation, String operationUrl, Boolean avoidThrowing, T& result)
       at Raven.Client.Connection.ServerClient.ExecuteWithReplication[T](String method, Func`2 operation)
       at Raven.Client.Connection.ServerClient.Put(String key, Nullable`1 etag, RavenJObject document, RavenJObject metadata)
       at Raven.Client.Document.HiLoKeyGenerator.PutDocument(JsonDocument document)
       at Raven.Client.Document.HiLoKeyGenerator.GetNextMax()
       at Raven.Client.Document.HiLoKeyGenerator.NextId()
       at Raven.Client.Document.HiLoKeyGenerator.GenerateDocumentKey(DocumentConvention convention, Object entity)
       at Raven.Client.Document.MultiTypeHiLoKeyGenerator.GenerateDocumentKey(DocumentConvention conventions, Object entity)
       at Raven.Client.Document.DocumentStore.<>c__DisplayClass1.<Initialize>b__0(Object entity)
       at Raven.Client.Document.InMemoryDocumentSessionOperations.GetOrGenerateDocumentKey(Object entity)
       at Raven.Client.Document.InMemoryDocumentSessionOperations.StoreInternal(Object entity, Nullable`1 etag, String id)
       at Raven.Client.Document.InMemoryDocumentSessionOperations.Store(Object entity)
       at NServiceBus.Timeout.Hosting.Windows.Persistence.RavenTimeoutPersistence.Add(TimeoutData timeout)
       at NServiceBus.Timeout.Core.TimeoutTransportMessageHandler.Handle(TransportMessage message)
       at NServiceBus.Unicast.Transport.Transactional.TransactionalTransport.OnTransportMessageReceived(TransportMessage msg)

我已经重新启动了 Raven 服务和 nservicebus 主机。我已经尝试重新创建这个传奇,但它仍然会发生。

正在安排的超时状态消息很小:

<Messages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://tempuri.net/Invoicing.Service">
    <IPartPaymentTimeout>
        <Amount>10.00</Amount>
        <OriginalTransactionTimeUtc>2013-01-14T05:49:04.8180938Z</OriginalTransactionTimeUtc>
        <PaymentNumber>7</PaymentNumber>
        <Id>123456</Id>
        <InvoiceNumber>1234567/34567</InvoiceNumber>
    </IPartPaymentTimeout>
</Messages>
4

1 回答 1

3

在我的案例中,这通过阻止 New Relic 对自定义应用程序进行检测来解决。看起来 New Relic 中有一个错误,它附加了一个请求标头X-NewRelic-ID,它会附加相同的数据,直到它变得太长:

X-NewRelic-ID: <hash>, <samehash>, <samehash>,.....<samehash>

在 NewRelic.xml 文件中禁用 NServiceBus.Host 检测会阻止发送标头。

在 NewRelic.xml 中,您还可以禁用crossApplicationTracingEnabled.

要检测这一点,请使用 System.Diagnostics 中的跟踪:

  <system.diagnostics>
<trace autoflush="true" />
<sources>
  <source name="System.Net" maxdatasize="1024">
    <listeners>
      <add name="MyTraceFile"/>
    </listeners>
  </source>
</sources>

<sharedListeners>
  <add
    name="MyTraceFile"
    type="System.Diagnostics.TextWriterTraceListener"
    initializeData="System.Net.trace.log"
            />
</sharedListeners>

<switches>
  <add name="System.Net" value="Verbose" />
</switches>

于 2013-05-14T00:52:34.393 回答