title: Apache ActiveMQ access without Spring.NET
body: <p>I'm hoping someone here will be able to aid me with my struggles with integration with ActiveMQ from C#. Here's what I did so far:</p>
  
  <pre><code>using Apache.NMS;
  using Apache.NMS.ActiveMQ;
  namespace JMSTest {
    class Program {
      static void Main(string[] args) {
        IConnectionFactory factory = new ConnectionFactory("tcp://localhost:61616/");
        IConnection connection = factory.CreateConnection();
        ISession session = connection.CreateSession();
      }
    }
  }
  </code></pre>
  
  <p>Pretty basic stuff: just create a connection factory, then use it to create the connection and at the end create a session. Now when I execute this code this is the exception that's being thrown:</p>
  
  <pre><code>System.ArgumentOutOfRangeException: Index and length must refer to a location within the string.
  Parameter name: length
     at System.String.InternalSubStringWithChecks(Int32 startIndex, Int32 length, Boolean fAlwaysCopy)
     at System.String.Substring(Int32 startIndex, Int32 length)
     at Apache.NMS.ActiveMQ.OpenWire.StringPackageSplitter.StringPackageSplitterEnumerator.System.Collections.IEnumerator.get_Current()
     at Apache.NMS.ActiveMQ.OpenWire.OpenWireBinaryWriter.Write(String text)
     at Apache.NMS.ActiveMQ.OpenWire.BaseDataStreamMarshaller.LooseMarshalString(String value, BinaryWriter dataOut)
     at Apache.NMS.ActiveMQ.OpenWire.V2.ConnectionIdMarshaller.LooseMarshal(OpenWireFormat wireFormat, Object o, BinaryWriter dataOut)
     at Apache.NMS.ActiveMQ.OpenWire.OpenWireFormat.LooseMarshalNestedObject(DataStructure o, BinaryWriter dataOut)
     at Apache.NMS.ActiveMQ.OpenWire.BaseDataStreamMarshaller.LooseMarshalCachedObject(OpenWireFormat wireFormat, DataStructure o, BinaryWriter dataOut)
     at Apache.NMS.ActiveMQ.OpenWire.V2.ConnectionInfoMarshaller.LooseMarshal(OpenWireFormat wireFormat, Object o, BinaryWriter dataOut)
     at Apache.NMS.ActiveMQ.OpenWire.OpenWireFormat.Marshal(Object o, BinaryWriter ds)
     at Apache.NMS.ActiveMQ.Transport.Tcp.TcpTransport.Oneway(Command command) : Transport connection error: Index and length must refer to a location within the string.
  Parameter name: length
  </code></pre>
  
  <p>Does anyone has any idea what's going on?  I'm using Apache ActiveMQ version 5.2.0 (fresh download from their web site).</p>