Ô´ÂëÍø,Ô´ÂëÂÛ̳,Ô´ÂëÖ®¼Ò,ÉÌÒµÔ´Âë,ÓÎÏ·Ô´ÂëÏÂÔØ,discuz²å¼þ,ÆåÅÆÔ´ÂëÏÂÔØ,¾«Æ·Ô´ÂëÂÛ̳

 ÕÒ»ØÃÜÂë
 Á¢¼´×¢²á
²é¿´: 89|»Ø¸´: 15

[ASP.NET] Microsoft .Net RemotingϵÁн̳ÌÖ®¶þ:Marshal¡¢DisconnectÓëÉúÃüÖÜÆÚÒÔ¼°¸ú×Ù·þÎñ

[¸´ÖÆÁ´½Ó]

7Íò

Ö÷Ìâ

861

»ØÌû

32Íò

»ý·Ö

ÂÛ̳ԪÀÏ

Rank: 8Rank: 8

»ý·Ö
329525
·¢±íÓÚ 2016-5-30 09:48:30 | ÏÔʾȫ²¿Â¥²ã |ÔĶÁģʽ
±¾ÎÄÖ÷Òª½²½â.Net RemotingÖÐMarshal¡¢DisconnectÓëÉúÃüÖÜÆÚÒÔ¼°¸ú×Ù·þÎñ£¬ÐèÒªµÄÅóÓÑ¿ÉÒԲο¼Ï¡£

Ò»¡¢Ô¶³Ì¶ÔÏóµÄ¼¤»î

¡¡¡¡ÔÚRemotingÖÐÓÐÈýÖÖ¼¤»î·½Ê½£¬Ò»°ãµÄʵÏÖÊÇͨ¹ýRemotingServicesÀàµÄ¾²Ì¬·½·¨À´Íê³É¡£¹¤×÷¹ý³ÌÊÂʵÉÏÊǽ«¸ÃÔ¶³Ì¶ÔÏó×¢²áµ½Í¨µÀÖС£ÓÉÓÚRemotingûÓÐÌṩÓëÖ®¶ÔÓ¦µÄUnregister·½·¨À´×¢ÏúÔ¶³Ì¶ÔÏó£¬ËùÒÔÈç¹ûÐèҪע²á/×¢ÏúÖ¸¶¨¶ÔÏó£¬Î¢ÈíÍƼöʹÓÃMarshal£¨Ò»°ãÒëΪ±à×飩ºÍDisconnectÅä¶ÔʹÓá£ÔÚ¡¶Net Remoting»ù´¡Æª¡·ÖÐÎÒÒѾ­Ì¸µ½£ºMarshal()·½·¨Êǽ«MarshalByRefObjectÀà¶ÔÏóת»¯ÎªObjRefÀà¶ÔÏó£¬Õâ¸ö¶ÔÏóÊÇ´æ´¢Éú³É´úÀíÒÔÓëÔ¶³Ì¶ÔÏóͨѶËùÐèµÄËùÓÐÏà¹ØÐÅÏ¢¡£ÕâÑù¾Í¿ÉÒÔ½«¸ÃʵÀýÐòÁл¯ÒÔ±ãÔÚÓ¦ÓóÌÐòÓòÖ®¼äÒÔ¼°Í¨¹ýÍøÂç½øÐд«Ê䣬¿Í»§¶Ë¾Í¿ÉÒÔµ÷ÓÃÁË¡£¶øDisconnect()·½·¨Ôò½«¾ßÌåµÄʵÀý¶ÔÏó´ÓͨµÀÖжϿª¡£

¡¡¡¡¸ù¾ÝÉÏÊö˵Ã÷£¬Marshal()·½·¨¶ÔÔ¶³Ì¶ÔÏóÒÔÒýÓ÷½Ê½½øÐбà×飨Marshal-by-Reference£¬MBR£©£¬²¢½«¶ÔÏóµÄ´úÀíÐÅÏ¢·Åµ½Í¨µÀÖС£¿Í»§¶Ë¿ÉÒÔͨ¹ýActivator.GetObject()À´»ñÈ¡¡£Èç¹ûÓû§Òª×¢Ïú¸Ã¶ÔÏó£¬Ôòͨ¹ýµ÷ÓÃDisconnect()·½·¨¡£ÄÇôÕâÖÖ·½Ê½¶ÔÓÚ±à×éµÄÔ¶³Ì¶ÔÏóÊÇ·ñ´æÔÚÉúÃüÖÜÆڵĹÜÀíÄØ£¿Õâ¾ÍÊDZ¾ÎÄËùÒªÃèÊöµÄÎÊÌâ¡£

¶þ¡¢ÉúÃüÖÜÆÚ

¡¡¡¡ÔÚCLRÖУ¬¿ò¼ÜÌṩÁËGC£¨À¬»ø»ØÊÕÆ÷£©À´¹ÜÀíÄÚ´æÖжÔÏóµÄÉúÃüÖÜÆÚ¡£Í¬ÑùµÄ£¬.Net RemotingʹÓÃÁËÒ»ÖÖ·Ö²¼Ê½À¬»ø»ØÊÕ£¬»ùÓÚ×âÓõÄÐÎʽÀ´¹ÜÀíÔ¶³Ì¶ÔÏóµÄÉúÃüÖÜÆÚ¡£

¡¡¡¡ÔçÆÚµÄDCOM¶ÔÓÚ¶ÔÏóÉúÃüÖÜÆڵĹÜÀíÊÇͨ¹ýpingºÍÒýÓüÆÊýÀ´È·¶¨¶ÔÏóºÎʱӦµ±×÷ΪÀ¬»ø»ØÊÕ¡£È»¶øpingÒýÆðµÄÍøÂçÁ÷Á¿¶Ô·Ö²¼Ê½Ó¦ÓóÌÐòµÄÐÔÄÜÊÇÒ»ÖÖÍ´¿àµÄ¸ºµ££¬Ëü´ó´óµØÓ°ÏìÁË·Ö²¼Ê½´¦ÀíµÄÕûÌåÐÔÄÜ¡£.Net RemotingÔÚÿ¸öÓ¦ÓóÌÐòÓòÖж¼ÒýÈëÒ»¸ö×âÓùÜÀíÆ÷£¬ÎªÃ¿¸ö·þÎñÆ÷¶ËµÄSingleTon£¬»òÿ¸ö¿Í»§¶Ë¼¤»îµÄÔ¶³Ì¶ÔÏó±£´æ×ŶÔ×âÓöÔÏóµÄÒýÓᣣ¨ËµÃ÷£º¶ÔÓÚ·þÎñÆ÷¶Ë¼¤»îµÄSingleCall·½Ê½£¬ÓÉÓÚËüÊÇÎÞ״̬µÄ£¬¶ÔÓÚÿ¸ö¼¤»îµÄÔ¶³Ì¶ÔÏ󣬶¼ÓÉCLRµÄGCÀ´×Ô¶¯»ØÊÕ£¬Òò´Ë¶ÔÓÚSingleCallģʽ¼¤»îµÄÔ¶³Ì¶ÔÏ󣬲»´æÔÚÉúÃüÖÜÆڵĹÜÀí¡££©

1¡¢×âÓÃ

¡¡¡¡×âÓÃÊǸö·â×°ÁËTimeSpanÖµµÄ¶ÔÏó£¬ÓÃÒÔ¹ÜÀíÔ¶³Ì¶ÔÏóµÄÉú´æÆÚ¡£ÔÚ.Net RemotingÖÐÌṩÁ˶¨Òå×âÓù¦ÄܵÄILease½Ó¿Ú¡£µ±Remotingͨ¹ýSingleTonģʽ»ò¿Í»§¶Ë¼¤»îģʽÀ´¼¤»îÔ¶³Ì¶ÔÏóʱ£¬×âÓöÔÏóµ÷ÓôÓSystem.MarshalByRefObject¼Ì³ÐµÄInitializeLifetimeService·½·¨£¬Ïò¶ÔÏóÇëÇó×âÓá£

ILease½Ó¿Ú¶¨ÒåÁËÓйØÉúÃüÖÜÆÚµÄÊôÐÔ£¬¾ùΪTimeSpanÖµ¡£ÈçÏ£º

InitialLeaseTime£º³õʼ»¯ÓÐЧʱ¼ä£¬Ä¬ÈÏֵΪ300Ã룬Èç¹ûΪ0£¬±íʾÓÀ²»¹ýÆÚ£»
RenewOnCallTime£ºµ÷ÓÃÔ¶³Ì¶ÔÏóÒ»¸ö·½·¨Ê±µÄ×âÓøüÐÂʱ¼ä£¬Ä¬ÈÏֵΪ120Ã룻
SponsorshipTimeout£º³¬Ê±Öµ£¬Í¨ÖªSponsor£¨·¢ÆðÈË£©×âÓùýÆÚºó£¬Remoting»áµÈ´ýµÄʱ¼ä£¬Ä¬ÈÏֵΪ120Ã룻
CurrentLeaseTime£ºµ±Ç°×âÓÃʱ¼ä£¬Ê״λñµÃ×âÓÃʱ£¬ÎªInitializeLeaseTimeµÄÖµ¡£

RemotingµÄÔ¶³Ì¶ÔÏóÒòΪ¼Ì³ÐÁËMarshalByRefObject£¬Òò´ËĬÈϼ̳ÐÁËInitializeLifetimeService·½·¨£¬ÄÇô×âÓõÄÏà¹ØÊôÐÔΪĬÈÏÖµ¡£Èç¹ûÒª¸Ä±äÕâЩÉèÖ㬿ÉÒÔÔÚÔ¶³Ì¶ÔÏóÖÐÖØд¸Ã·½·¨¡£ÀýÈ磺

public override object InitializeLifetimeService()
{
 ILease lease = (ILease)base.InitializeLifetimeService();
 if (lease.CurrentState == LeaseState.Initial)
 {
 lease.InitialLeaseTime = TimeSpan.FromMinutes(1);
 lease.RenewOnCallTime = TimeSpan.FromSeconds(20);
 }
 return lease; 
}

Ò²¿ÉÒÔºöÂԸ÷½·¨£¬½«¶ÔÏóµÄ×âÓÃÖÜÆڸıäΪÎÞÏÞ£º

public override object InitializeLifetimeService()
{
 return null;
}

2¡¢×âÓùÜÀíÆ÷

¡¡¡¡Èç¹ûÊÇÇ°ÃæËù˵µÄ×âÓÃÖ÷ÒªÊÇÓ¦ÓÃÔÚÿ¸ö¾ßÌåµÄÔ¶³Ì¶ÔÏóÉÏ£¬ÄÇô×âÓùÜÀíÆ÷ÊÇ·þÎñÆ÷¶ËרÃÅÓÃÀ´¹ÜÀíÔ¶³Ì¶ÔÏóÉúÃüÖÜÆڵĹÜÀíÆ÷£¬Ëüά³Ö×ÅÒ»¸öSystem.Hashtable³ÉÔ±£¬½«×âÓÃÓ³ÉäΪSystem.DateTimeʵÀý±íʾÿ¸ö×âÓúÎʱӦ¹ýÆÚ¡£Remoting²ÉÓÃÂÖѯµÄ·½Ê½ÒÔÒ»¶¨µÄʱ¼ä»½ÐÑ×âÓùÜÀíÆ÷£¬¼ì²éÿ¸ö×âÓÃÊÇ·ñ¹ýÆÚ¡£Ä¬ÈÏΪÿ10ÃëÖÓ»½ÐÑÒ»´Î¡£ÂÖѯµÄ¼ä¸ô¿ÉÒÔÅäÖã¬È罫ÂÖѯ¼ä¸ôÉèÖÃΪ5·ÖÖÓ£º

LifetimeService.LeaseManagerPollTime = System.TimeSpan.FromMinutes(5);

ÎÒÃÇ»¹¿ÉÒÔÔÚ×âÓùÜÀíÆ÷ÖÐÉèÖÃÔ¶³Ì¶ÔÏó×âÓõÄÊôÐÔ£¬Èç¸Ä±äÔ¶³Ì¶ÔÏóµÄ³õʼÓÐЧʱ¼äΪÓÀ¾ÃÓÐЧ£º

LifetimeServices.LeaseTime = TimeSpan.Zero;

ÎÒÃÇÒ²¿ÉÒÔͨ¹ýÅäÖÃÎļþÀ´ÉèÖÃÉúÃüÖÜÆÚ£¬È磺

<configuration>
 <system.runtime.remoting>
 <application name = "SimpleServer">
  <lifetime leaseTime = "0" sponsorshipTimeOut = "1M" renewOnCallTime = "1M" pollTime = "30S"/> 
 </application>
 </system.runtime.remoting>
</configuration>

×¢£ºÅäÖÃÎļþÖеÄpollTime¼´ÎªÉÏÃæËù˵µÄ×âÓùÜÀíÆ÷µÄÂÖѯ¼ä¸ôʱ¼äLeaseManagerPollTime¡£

¡¡¡¡×âÓùÜÀíÆ÷¶ÔÓÚÉúÃüÖÜÆÚµÄÉèÖÃÊÇÕë¶Ô·þÎñÆ÷ÉÏËùÓеÄÔ¶³Ì¶ÔÏó¡£µ±ÎÒÃÇͨ¹ýÅäÖÃÎļþ»ò×âÓùÜÀíÆ÷ÉèÖÃ×âÓõÄÊôÐÔʱ£¬ËùÓÐÔ¶³Ì¶ÔÏóµÄÉúÃüÖÜÆÚ¶¼×ñÑ­¸ÃÉèÖ㬳ý·ÇÎÒÃǶÔÓÚÖ¸¶¨µÄÔ¶³Ì¶ÔÏóͨ¹ýÖØдInitializeLifetimeService·½·¨£¬¸Ä±äÁËÏà¹ØÅäÖá£Ò²¾ÍÊÇ˵£¬Ô¶³Ì¶ÔÏóµÄ×âÓÃÅäÖÃÓÅÏȼ¶¸ßÓÚ·þÎñÆ÷¶ËÅäÖá£

3¡¢·¢ÆðÈË£¨Sponsor£©

¡¡¡¡·¢ÆðÈËÊÇÕë¶Ô¿Í»§¶Ë¶øÑԵġ£Ô¶³Ì¶ÔÏó¾ÍÊÇ·¢ÆðÈËÒª×âÓõĶÔÏ󣬷¢ÆðÈË¿ÉÒÔÓë·þÎñÆ÷¶ËÇ©¶©×âÔ¼£¬Ô¼¶¨×âÓÃʱ¼ä¡£Ò»µ©µ½Æں󣬷¢ÆðÈË»¹¿ÉÒÔÐø×⣬¾ÍÏñÏÖʵÉú»îÖÐ×â·½µÄÆõÔ¼£¬·¿¶«¡¢×â·¿ÕßÖ®¼äµÄ¹ØϵһÑù¡£

¡¡¡¡ÔÚ.Net FrameworkÖеÄSystem.Runtime.Remoting.LifetimeÃüÃû¿Õ¼äÖж¨ÒåÁËClientSponsorÀ࣬¸ÃÀà¼Ì³ÐÁËSystem.MarshalByRefObject£¬²¢ÊµÏÖÁËISponsor½Ó¿Ú¡£ClientSponsorÀàµÄÊôÐԺͷ½·¨£¬¿ÉÒԲο¼MSDN¡£

¡¡¡¡¿Í»§¶ËҪʹÓ÷¢ÆðÈË»úÖÆ£¬±ØÐë´´½¨ClientSponsorÀàµÄÒ»¸öʵÀý¡£È»ºóµ÷ÓÃÏà¹Ø·½·¨ÈçRegister()»òRenewal()·½·¨À´×¢²áÔ¶³Ì¶ÔÏó»òÑÓ³¤ÉúÃüÖÜÆÚ¡£È磺

RemotingObject obj = new RemotingObject();
ClientSponsor sponsor = new ClientSponsor();
sponsor.RenewalTime = TimeSpan.FromMinutes(2);
sponsor.Register(obj);

Ðø×âʱ¼äÒ²¿ÉÒÔÔÚClientSponsorµÄ¹¹Ô캯ÊýÖÐÖ±½ÓÉèÖã¬È磺

ClientSponsor sponsor = new ClientSponsor(TimeSpan.FromMinutes(2));
sponsor.Register(obj);

ÎÒÃÇÒ²¿ÉÒÔ×Ô¼º±àдSponsorÀ´¹ÜÀí·¢ÆðÈË»úÖÆ£¬Õâ¸öÀà±ØÐë¼Ì³ÐClientSponsor²¢ÊµÏÖISponsor½Ó¿Ú¡£

Èý¡¢¸ú×Ù·þÎñ

¡¡¡¡ÈçÇ°ËùÊö£¬ÎÒÃÇÒªÅжÏͨ¹ýMarshal±à×éÔ¶³Ì¶ÔÏóÊÇ·ñ´æÔÚÉúÃüÖÜÆڵĹÜÀí¡£ÔÚRemotingÖУ¬¿ÉÒÔͨ¹ý¸ú×Ù·þÎñ³ÌÐòÀ´¼àÊÓMBR¶ÔÏóµÄ±à×é½ø³Ì¡£

¡¡¡¡ÎÒÃÇ¿ÉÒÔ´´½¨Ò»¸ö¼òµ¥µÄ¸ú×Ù´¦Àí³ÌÐò£¬¸Ã³ÌÐòʵÏÖ½Ó¿ÚITrackingHandler¡£½Ó¿ÚITrackingHandler¶¨ÒåÁË3¸ö·½·¨£¬MarshalObject¡¢UnmarshalObjectºÍDisconnectedObject¡£µ±Ô¶³Ì¶ÔÏó±»±à×é¡¢½â×éºÍ¶Ï¿ªÁ¬½Óʱ£¬¾Í»áµ÷ÓÃÏàÓ¦µÄ·½·¨¡£ÏÂÃæÊǸøú×Ù´¦ÀíÀàµÄ´úÂ룺

public class MyTracking:ITrackingHandler
{
 public MyTracking()
 {
 //
 // TODO: ÔÚ´Ë´¦Ìí¼Ó¹¹Ô캯ÊýÂß¼­
 //
 }

 public void MarshaledObject(object obj,ObjRef or)
 {
 Console.WriteLine();
 Console.WriteLine("¶ÔÏó" + obj.Tostring() + " is marshaled at " + DateTime.Now.ToShortTimeString());
 }

 public void UnmarshaledObject(object obj,ObjRef or)
 {
 Console.WriteLine();
 Console.WriteLine("¶ÔÏó" + obj.Tostring() + " is unmarshaled at " + DateTime.Now.ToShortTimeString());
 }

 public void DisconnectedObject(object obj)
 {
 Console.WriteLine(obj.ToString() + " is disconnected at " + DateTime.Now.ToShortTimeString());
 }
}

È»ºóÔÙ·þÎñÆ÷¶Ë´´½¨¸Ã¸ú×Ù´¦ÀíÀàµÄʵÀý£¬²¢×¢²á¸ú×Ù·þÎñ£º
TrackingServices.RegisterTrackingHandler(new MyTracking());

ËÄ¡¢²âÊÔ

1¡¢½¨Á¢Á½¸öÔ¶³Ì¶ÔÏ󣬲¢ÖØдInitializeLifetimeService·½·¨£º

¶ÔÏóÒ»£ºAppService1
³õʼÉúÃüÖÜÆÚ£º1·ÖÖÓ

public class AppService1:MarshalByRefObject
{
 public void PrintString(string contents)
 {
 Console.WriteLine(contents); 
 }

 public override object InitializeLifetimeService()
 {
 ILease lease = (ILease)base.InitializeLifetimeService();
 if (lease.CurrentState == LeaseState.Initial)
 {
  lease.InitialLeaseTime = TimeSpan.FromMinutes(1);
  lease.RenewOnCallTime = TimeSpan.FromSeconds(20);
 }
 return lease;
 }
}

¶ÔÏó¶þ£ºAppService2
³õʼÉúÃüÖÜÆÚ£º3·ÖÖÓ

public class AppService2:MarshalByRefObject
{
 public void PrintString(string contents)
 {
 Console.WriteLine(contents); 
 }

 public override object InitializeLifetimeService()
 {
 ILease lease = (ILease)base.InitializeLifetimeService();
 if (lease.CurrentState == LeaseState.Initial)
 {
  lease.InitialLeaseTime = TimeSpan.FromMinutes(3);
  lease.RenewOnCallTime = TimeSpan.FromSeconds(40);
 }
 return lease;
 }
}

Ϊ¼ò±ãÆð¼û£¬Á½¸ö¶ÔÏóµÄ·½·¨¶¼Ò»Ñù¡£

2¡¢·þÎñÆ÷¶Ë

(1) Ê×ÏȽ¨Á¢ÈçÉϵļà¿Ø´¦ÀíÀࣻ

(2) ×¢²áͨµÀ£º

TcpChannel channel = new TcpChannel(8080);
ChannelServices.RegisterChannel(channel);

(3) ÉèÖÃ×âÓùÜÀíÆ÷µÄ³õʼ×âÓÃʱ¼äΪÎÞÏÞ£º

LifetimeServices.LeaseTime = TimeSpan.Zero;

(4) ´´½¨¸Ã¸ú×Ù´¦ÀíÀàµÄʵÀý£¬²¢×¢²á¸ú×Ù·þÎñ£º

TrackingServices.RegisterTrackingHandler(new MyTracking());

(5) ±à×éÁ½¸öÔ¶³Ì¶ÔÏó£º

ServerAS.AppService1 service1 = new ServerAS1.AppService1();
ObjRef objRef1 = RemotingServices.Marshal((MarshalByRefObject)service1,"AppService1");

ServerAS.AppService2 service2 = new ServerAS1.AppService2();
ObjRef objRef2 = RemotingServices.Marshal((MarshalByRefObject)service2,"AppService2");

(6) ʹ·þÎñÆ÷¶Ë±£³ÖÔËÐУº

Console.WriteLine("Remoting·þÎñÆô¶¯£¬°´Í˳ö..."); 
Console.ReadLine();

3¡¢¿Í»§¶Ë

ͨ¹ýActivator.GetObject()»ñµÃÁ½¸öÔ¶³Ì¶ÔÏ󣬲¢µ÷ÓÃÆä·½·¨PrintString¡£´úÂëÂÔ¡£

4¡¢ÔËÐвâÊÔ£º

ÔËÐзþÎñÆ÷¶ËºÍ¿Í»§¶Ë£¬ÓÉÓÚ¼à¿Ø³ÌÐò½«¼àÊÓÔ¶³Ì¶ÔÏóµÄ±à×é½ø³Ì£¬Òò´ËÔÚÔËÐпªÊ¼£¬¾Í»áÏÔʾԶ³Ì¶ÔÏóÒѾ­±»Marshal£º

https://www.jb51.net/files.jb51.net/file_images/article/201605/201605300945331.gif

È»ºóÔÙ¿Í»§¶Ëµ÷ÓÃÕâÁ½¸öÔ¶³Ì¶ÔÏóµÄPrintString·½·¨£¬·þÎñÆ÷¶Ë½ÓÊÜ×Ö·û´®£º

https://www.jb51.net/files.jb51.net/file_images/article/201605/201605300945332.gif

Ò»·ÖÖÓºó£¬Ô¶³Ì¶ÔÏóÒ»×Ô¶¯±»Disconnect£º

https://www.jb51.net/files.jb51.net/file_images/article/201605/201605300945333.gif

´Ëʱ¿Í»§¶ËÈçÒªµ÷ÓÃÔ¶³Ì¶ÔÏóÒ»£¬»áÅ׳öRemotingExceptionÒì³££»

ÓÖÒ»·ÖÖÓºó£¬Ô¶³Ì¶ÔÏó¶þ±»DisconnectÁË£º

https://www.jb51.net/files.jb51.net/file_images/article/201605/201605300945334.gif

¡¡¡¡Óû§»¹¿ÉÒÔ¸ù¾ÝÕâ¸ö´úÂë²âÊÔRenewOnCallTimeµÄʱ¼äÊÇ·ñÕýÈ·¡£Ò²¼´ÊÇ˵£¬ÔÚ¶ÔÏó»¹Î´±»Disconnectʱ£¬µ÷ÓöÔÏó£¬Ôò´Óµ÷ÓöÔÏóµÄÕâÒ»¿ÌÆð£¬ÆäÉúÃüÖÜÆÚ²»ÔÙÊÇÔ­À´É趨µÄ³õʼÓÐЧʱ¼äÖµ£¨InitialLeaseTime£©£¬¶øÊÇ×âÓøüÐÂʱ¼äÖµ£¨RenewOnCallTime£©¡£ÁíÍ⣬Èç¹ûÕâÁ½¸öÔ¶³Ì¶ÔÏóûÓÐÖØдInitializeLifetimeService·½·¨£¬ÔòÉúÃüÖÜÆÚӦΪ×âÓùÜÀíÆ÷ËùÉ趨µÄÖµ£¬ÎªÓÀ¾ÃÓÐЧ£¨ÉèÖÃΪ0£©¡£ÄÇôÕâÁ½¸ö¶ÔÏ󲻻ᱻ×Ô¶¯Disconnect£¬³ý·ÇÎÒÃÇÏÔʽָ¶¨¹Ø±ÕËüµÄÁ¬½Ó¡£µ±È»£¬Èç¹ûÎÒÃÇÏÔʽ¹Ø±ÕÁ¬½Ó£¬¸ú×Ù³ÌÐòÈÔÈ»»á¼àÊÓµ½ËüµÄ±ä»¯£¬È»ºóÏÔʾ³öÀ´¡£

Îå¡¢½áÂÛ

¡¡¡¡Í¨¹ýÎÒÃǵIJâÊÔ£¬Æäʵ½áÂÛÒѾ­ºÜÃ÷ÏÔÁË¡£Í¨¹ýMarshal±à×éµÄ¶ÔÏóÒªÊܵ½×âÓõÄÉúÃüÖÜÆÚËù¿ØÖÆ¡£×¢Òâ¶ÔÏó±»Disconnect£¬²¢²»ÊÇÖ¸Õâ¸ö¶ÔÏó±»GC»ØÊÕ£¬¶øÊÇÖ¸Õâ¸ö¶ÔÏó±£´æÔÚͨµÀµÄÏà¹Ø´úÀíÐÅÏ¢±»¶Ï¿ªÁË£¬¶ø¶ÔÏó±¾ÉíÈÔÈ»ÔÚ·þÎñÆ÷¶Ë´æÔÚ¡£

¡¡¡¡ËùÒÔÎÒÃÇͨ¹ýRemotingÌṩ·þÎñ£¬Ó¦¸ù¾Ýʵ¼ÊÇé¿öÖ¸¶¨Ô¶³Ì¶ÔÏóµÄÉúÃüÖÜÆÚ£¬Èç¹û²»Ö¸¶¨£¬ÔòΪRemotingĬÈϵÄÉ趨¡£ÒªÈÃËùÓеÄÔ¶³Ì¶ÔÏóÓÀ¾ÃÓÐЧ£¬¿ÉÒÔͨ¹ýÅäÖÃÎļþ»ò×âÓùÜÀíÆ÷½«³õʼÓÐЧʱ¼äÉèΪ0¡£

¡¡¡¡ÒÔÉϾÍÊÇ.Net RemotingÖÐMarshal¡¢DisconnectÓëÉúÃüÖÜÆÚÒÔ¼°¸ú×Ù·þÎñÈ«²¿ÄÚÈÝ£¬Ï£ÍûÄܸø´ó¼ÒÒ»¸ö²Î¿¼£¬Ò²Ï£Íû´ó¼Ò¶à¶àÖ§³Ö½Å±¾Ö®¼Ò¡£

»Ø¸´

ʹÓõÀ¾ß ¾Ù±¨

0

Ö÷Ìâ

2Íò

»ØÌû

0

»ý·Ö

Ö춻áÔ±

Rank: 3Rank: 3

»ý·Ö
0
·¢±íÓÚ 2022-9-4 11:37:31 | ÏÔʾȫ²¿Â¥²ã
¶ùͯ·þÎñç³ÎÅç³ÎÅç³ÎÅ

0

Ö÷Ìâ

2Íò

»ØÌû

0

»ý·Ö

Ö춻áÔ±

Rank: 3Rank: 3

»ý·Ö
0
·¢±íÓÚ 2022-9-19 11:36:14 | ÏÔʾȫ²¿Â¥²ã
¹à¹à¹à¹àË®

14

Ö÷Ìâ

1Íò

»ØÌû

75

»ý·Ö

×¢²á»áÔ±

Rank: 2

»ý·Ö
75
·¢±íÓÚ 2022-11-20 03:32:36 | ÏÔʾȫ²¿Â¥²ã
³é¸ùÑÌ£¬ÏÂÀ´¿´¿´ÔÙ˵

6

Ö÷Ìâ

2Íò

»ØÌû

425

»ý·Ö

Ö춻áÔ±

Rank: 3Rank: 3

»ý·Ö
425
·¢±íÓÚ 2023-1-8 08:45:34 | ÏÔʾȫ²¿Â¥²ã
ŶŶŶŶŶŶŶŶŶ

2

Ö÷Ìâ

2Íò

»ØÌû

67

»ý·Ö

×¢²á»áÔ±

Rank: 2

»ý·Ö
67
·¢±íÓÚ 2023-6-23 02:12:20 | ÏÔʾȫ²¿Â¥²ã
ÌìÌìÔ´ÂëÉçÇø¡£¡£¡£¡£

1

Ö÷Ìâ

2Íò

»ØÌû

155

»ý·Ö

×¢²á»áÔ±

Rank: 2

»ý·Ö
155
·¢±íÓÚ 2023-8-3 02:37:13 | ÏÔʾȫ²¿Â¥²ã
ͦ²»´íµÄ¶«Î÷

0

Ö÷Ìâ

1Íò

»ØÌû

0

»ý·Ö

Ö춻áÔ±

Rank: 3Rank: 3

»ý·Ö
0
·¢±íÓÚ 2023-8-5 14:01:34 | ÏÔʾȫ²¿Â¥²ã
ÓÐʲôºÃµÄ·þÎñÆ÷

1

Ö÷Ìâ

2Íò

»ØÌû

319

»ý·Ö

Ö춻áÔ±

Rank: 3Rank: 3

»ý·Ö
319
·¢±íÓÚ 2024-1-26 18:43:44 | ÏÔʾȫ²¿Â¥²ã
2222222222222222

3

Ö÷Ìâ

1Íò

»ØÌû

50

»ý·Ö

×¢²á»áÔ±

Rank: 2

»ý·Ö
50
·¢±íÓÚ 2024-5-25 04:11:41 | ÏÔʾȫ²¿Â¥²ã
½¨¾ü½Ú½¨¾ü½Ú½¨¾ü½Ú½¨¾ü½Ú
¸ß¼¶Ä£Ê½
B Color Image Link Quote Code Smilies

±¾°æ»ý·Ö¹æÔò

ÊÖ»ú°æ|СºÚÎÝ|ÍøÕ¾µØͼ|Ô´ÂëÂÛ̳ ( º£Íâ°æ )

GMT+8, 2025-1-23 03:52 , Processed in 0.067804 second(s), 24 queries .

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

¿ìËٻظ´ ·µ»Ø¶¥²¿ ·µ»ØÁбí