【发布时间】:2011-07-17 07:49:39
【问题描述】:
我正在尝试发布消息(C# 控制台应用程序):
var client = new WeborbClient("http://localhost:57433/weborb.aspx", "MyDestination");
client.Publish("test message");
...得到NullReferenceException:
在 Weborb.Writer.ObjectWriter.write(Object obj, IProtocolFormatter writer) 在 Weborb.Writer.ObjectReferenceWriter.write(Object obj, IProtocolFormatter 格式化程序) 在 Weborb.Writer.ArrayWriter.write(Object obj, IProtocolFormatter writer) 在 Weborb.Writer.ArrayReferenceWriter.write(Object obj, IProtocolFormatter 格式化程序) 在 Weborb.Writer.MessageWriter.writeObject(Object obj, IProtocolFormatter 格式化程序) 在 Weborb.Writer.AMFBodyWriter.write(Object obj, IProtocolFormatter writer) 在 Weborb.Writer.MessageWriter.writeObject(Object obj, IProtocolFormatter 格式化程序) 在 Weborb.Util.Cache.Cache.WriteAndSave(对象 obj,IProtocolFormatter 格式化程序) 在 Weborb.Writer.AMFMessageWriter.write(Object obj, IProtocolFormatter writer) 在 Weborb.Writer.MessageWriter.writeObject(Object obj, IProtocolFormatter 格式化程序) 在 Weborb.Util.AMFSerializer.SerializeToBytes(对象 obj,Int32 序列化类型) 在 Weborb.Util.AMFSerializer.SerializeToBytes(对象 obj) 在 Weborb.Client.HttpEngine.CreateRequest(V3Message v3Msg,Dictionary
2 headers) at Weborb.Client.HttpEngine.CreateRequest(V3Message v3Msg) at Weborb.Client.HttpEngine.SendRequest[T](V3Message v3Msg, Responder1 响应者,布尔 isSubscription) 在 Weborb.Client.Engine.SendRequest[T](V3Message v3Msg,Responder1 responder) at Weborb.Client.WeborbClient.Publish(Object message, Dictionary2 标头,字符串子主题,PublishingResponder 响应者) 在 Weborb.Client.WeborbClient.Publish(对象消息,字典`2 标头)
从 Flex 应用程序成功发布到同一目标:
<mx:ChannelSet id="channelSet">
<mx:AMFChannel url="http://localhost:57433/weborb.aspx"/>
</mx:ChannelSet>
<mx:Producer id="producer"
channelSet="{channelSet}"
destination="MyDestination" />
// ...
var message:AsyncMessage = new AsyncMessage( "weborb messaging is cool" );
producer.send( message );
【问题讨论】: