- PR -

スレッド内から.NET Remotingオブジェクトへの参照が途中で停止してしまう

1
投稿者投稿内容
yuta
会議室デビュー日: 2005/11/16
投稿数: 13
お住まい・勤務地: 愛知県→静岡県(転勤)
投稿日時: 2006-03-01 13:34
 yutaです。
 毎度参考にさせて頂いています。
 下記の内容についてよろしくお願いします。

【現状】
  WebサーバーアプリとWindowsサービス間でデータを共有させるべく
  .NETのRemotingを実現。
  (Windowsサービス:サーバー側、Webサーバーアプリ:クライアント側)
【問題】
  Windowsサービス内に設けてあるスレッド内から定周期で.NETのRemoting
  でやり取りしたいオブジェクトに対して、オブジェクトの取得/セットを
  行ってますがデバッグプロセスで追ってみるとWindowsサービスを起動し
  て約10分くらいで必ずWindowsサービスが固まってしまう。

 以下にソースの一部を記載します。

//************************************************
 // .NETのRemotingでやり取りを行う中間オブジェクト
//************************************************
 namespace RemoteLibrary
{
public class CRemote:System.MarshalByRefObject
{
private static object m_objReceiveState;
public object objReceiveState{
get{return m_objReceiveState;}
set{m_objReceiveState = value}
}
   ・
   ・

[SerializableAttribute]
public class CReceiveState
{
public Point[]m_ptRecentPos;
public Point[]m_ptTargetPos;

     ・
}

//************************************************
 // Windowsサービス(サーバー側)
//************************************************
 protected override void OnStart(string[] args)
 {
  m_TcpChan = new TcpChannel(1000);
  ChannelServices.RegisterChannel(m_TcpChan);
  RemotingConfiguration.RegisterWellKnownServiceType(Type.GetType
  ("DeliveryLibrary.CRemote,DeliveryLibrary"), "test", WellKnownOb
  jectMode.Singleton);
  m_RemoteObj = (RemoteLibrary.CRemote)(Activator.GetObject(typeof
(RemoteLibrary.CRemote), "tcp://localhost:1000/test"));
  ・
  ・
 }

 private bool ThreadProc() ←スレッド内から定周期で呼ばれる関数
{
// 取得
   RemoteLibrary.CReceiveState receiveState =
(RemoteLibrary.CReceiveState)m_RemoteObj.objReceiveState; ←約10分位動かすと必ずここで固まる
   ・
   ・
   ・
   // 再セット
m_RemoteObj.objReceiveState = receiveState;
}


 尚、.NET Remotingオブジェクトの作成には次のサイトを参考にしました。
 http://www.unisys.co.jp/club/net_view/20030303.html

 [開発環境] .NET2003 C# + ASP.NET(.netFramework 1.1 + SP1)
yuta
会議室デビュー日: 2005/11/16
投稿数: 13
お住まい・勤務地: 愛知県→静岡県(転勤)
投稿日時: 2006-03-03 20:32
 yutaです。
 自己レスです。
 使用しているコンポーネントが原因でした。
 現象と原因が"全く"結びつかなかったので原因を特定するのに時間を要しました。
 色々とお騒がせして申し訳ありませんでした。
1

スキルアップ/キャリアアップ(JOB@IT)