Static methods can not be called remotely

Static methods can not be called remotely

 


The client application can not access to static methods / properties / fields remotely. Since you access a static method using CLASSNAME.STATICMETHOD, instead of OBJREF.STATICMETHOD, there’s no proxy involved. So access to static methods always takes place in the client’s context.

 

But you can add a thin non-static wrapper around each static method in order to remote calling.

 

Take the following code snippet as an example:

public class MyClass : MarshalByRefObject

 {

   public static void DoSomething (...) // Can not be called remotely

   {

     ...

   }

 

   public void DoSomethingWrapper (...) // Can be called remotely

   {

     DoSomething (...);

   }

 }

 


 Refer to the articles as follows to get more information:

1. 深度探索.Net Remoting基础架构
http://www.cnblogs.com/rickie/archive/2004/10/22/55292.html
2. 尝试RemotingSqlHelper的若干问题,
http://www.cnblogs.com/rickie/archive/2004/10/13/51500.html


 

 

 

posted @   Rickie  阅读(1199)  评论(1编辑  收藏  举报
编辑推荐:
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
阅读排行:
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?
点击右上角即可分享
微信分享提示