Remoting使用com+组件问题 高分!

lemonvital0 2008-01-31 03:10:40
最近写了一个分布式系统,使用remoting和com+组件,服务端运行在单核cpu上正常,但是运行在多核或者具有超线程的cpu上就不稳定,表现为100次调用总会有几次失败,而且客户端越多,出错几率越高. cpu的核越多,出错几率也越高,在四核上很明显.
如果用remoting和普通的dll什么问题也没有,直接调用com+组件也没事,两者一结合就出问题,有没有哪位专家可以指点指点是怎么回事呢??
...全文
273 17 打赏 收藏 转发到动态 举报
写回复
用AI写文章
17 条回复
切换为时间正序
请发表友善的回复…
发表回复
lemonvital0 2008-02-20
  • 打赏
  • 举报
回复
to liuzuofei
我看了你blog,你近段时间也做过类似的项目吧,你有没有试过在多核的环境下测试过呢,我给你留言了不知道收到没,有空我们交流交流吧.
lemonvital0 2008-02-20
  • 打赏
  • 举报
回复
有使用对象池的.
liuzuofei 2008-02-20
  • 打赏
  • 举报
回复
使用对象池嘛??
lemonvital0 2008-02-20
  • 打赏
  • 举报
回复
没人关注了
lemonvital0 2008-02-19
  • 打赏
  • 举报
回复
顶啊
lemonvital0 2008-02-15
  • 打赏
  • 举报
回复
再顶,欢迎有经验的来交流交流
nate_liu 2008-02-01
  • 打赏
  • 举报
回复
頂這個
lemonvital0 2008-02-01
  • 打赏
  • 举报
回复
继续顶,没人类似做过?
lemonvital0 2008-01-31
  • 打赏
  • 举报
回复
com+组件代码如下
public class MyObject:ServicedComponent
{
public int Add(int a, int b)
{
return a + b;
}


}
lemonvital0 2008-01-31
  • 打赏
  • 举报
回复
请查收,
hopewoo 2008-01-31
  • 打赏
  • 举报
回复
sonic260◎163.com
现在发把,qq 也行
lemonvital0 2008-01-31
  • 打赏
  • 举报
回复
以下是错误信息
客户端直接在服务端的计算机上运行
出错:-无法访问已释放的对象。
对象名:“ServicedComponent”。
英文:Cannot access a disposed object.
Object name: 'ServicedComponent'.
Server stack trace:
在 System.EnterpriseServices.Thunk.Callback.DoCallback(Object otp, IMessage msg, IntPtr ctx, Boolean fIsAutoDone, MemberInfo mb, Boolean bHasGit)
在 System.EnterpriseServices.ServicedComponentProxy.CrossCtxInvoke(IMessage reqMsg)
在 System.EnterpriseServices.ServicedComponentProxy.Invoke(IMessage request)
在 System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
在 ComB.Class1.m_mthIsCanDo(String p_flag)
在 System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
在 System.Runtime.Remoting.Messaging.StackBuilderSink.PrivateProcessMessage(RuntimeMethodHandle md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
在 System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext)

Exception rethrown at [0]:
在 System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
在 System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
在 ComB.Class1.m_mthIsCanDo(String p_flag)
在 MiddleServerCompressTest.Form1.RunTest()


客户端在其他计算机上运行
出错:-服务器遇到内部错误。有关更多信息,请关闭服务器的 .config 文件中的 customErrors。
英文:Server encountered an internal error. For more information, turn off customErrors in the server's .config file.
Server stack trace:
Exception rethrown at [0]:
在 System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
在 System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
在 ComA.Class1.m_lngGetTakeGeg(IPrincipal p_objPrincipal, String strDoctor, String strBeginDate, String strEndDate, DataTable& dt)
在 MiddleServerCompressTest.Form1.RunTestIIS()


出错:-Object reference not set to an instance of an object.
Server stack trace:
at System.Runtime.Remoting.IdentityHolder.RemoveIdentity(String uri, Boolean bResetURI)
at System.Runtime.Remoting.RemotingServices.Disconnect(MarshalByRefObject obj, Boolean bResetURI)
at System.EnterpriseServices.ServicedComponent.DisposeObject(ServicedComponent sc)
at System.EnterpriseServices.ServicedComponent.Dispose()
at System.Runtime.Remoting.Messaging.ServerContextTerminatorSink.SyncProcessMessage(IMessage reqMsg)
at System.Runtime.Remoting.Channels.CrossContextChannel.SyncProcessMessageCallback(Object[] args)
at System.Threading.Thread.CompleteCrossContextCallback(InternalCrossContextDelegate ftnToCall, Object[] args)
at System.Threading.Thread.InternalCrossContextCallback(Context ctx, IntPtr ctxID, Int32 appDomainID, InternalCrossContextDelegate ftnToCall, Object[] args)
at System.Runtime.Remoting.Channels.CrossContextChannel.SyncProcessMessage(IMessage reqMsg)

Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at ComA.Class1.m_lngGetTakeGeg(IPrincipal p_objPrincipal, String strDoctor, String strBeginDate, String strEndDate, DataTable& dt)
at MiddleServerCompressTest.Form1.RunTestIIS()
lemonvital0 2008-01-31
  • 打赏
  • 举报
回复
to hopewoo
如果你有多核或者超线程环境,可以发给你测试看看,留个mail
hopewoo 2008-01-31
  • 打赏
  • 举报
回复
对了,LZ的出错,具体错误信息是什么?
lemonvital0 2008-01-31
  • 打赏
  • 举报
回复
to hopewoo
但是我采用的是服务器端singlecall的方式激活,应该可以这样理解,每调用一个对象会新生成一个实例,用完后则有gc销毁了.也就是说你调用你,我调用我的,这样也会冲突吗?
yuan731 2008-01-31
  • 打赏
  • 举报
回复
hopewoo 2008-01-31
  • 打赏
  • 举报
回复
这样的话,估计是不同步了,远程调用时候用到的对象在别的地方被修改了,因为单核的CPU不存在“同时”这个概念,都是按照时间片一次一次执行的,但多核就会有同时并发可能性,建议lz在使用remoting中的非局部对象之前,先用lock锁一下,看看情况会不会改善点。

110,533

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧