如何从asp.net中发起一个remoting调用?

unalone 2006-06-12 09:56:21
现在因为需要,要从asp.net页面中发起一个remoting调用,但是经查知,asp.net代码属于部分受信任代码,无法访问remoting中内容,如何解决?
...全文
168 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
szc21 2006-08-03
  • 打赏
  • 举报
回复
up
haipingma 2006-08-03
  • 打赏
  • 举报
回复
mark
unalone 2006-06-29
  • 打赏
  • 举报
回复
那我要从Asp.net中调用外部进程中的对象呢?该怎么做?有人能给一个完整的范例么?
分享大哥 2006-06-12
  • 打赏
  • 举报
回复
帮你顶, 等待高手

:)
sbsrg3000 2006-06-12
  • 打赏
  • 举报
回复
up
unalone 2006-06-12
  • 打赏
  • 举报
回复
我不是要这样的方式,我使用一个独立的进程或者服务来承载Remoting服务,不是把Remoting放在IIS中,这样该怎么做?
lazyfish 2006-06-12
  • 打赏
  • 举报
回复
http://www.eggheadcafe.com/articles/20031124.asp
超级大笨狼 2006-06-12
  • 打赏
  • 举报
回复
服务器端代码


  表1:Server.cs源代码



Server.cs
using System;
using System.Runtime.Remoting;

public class Server{
public static void Main(string[] Args){

// Load the configuration file
RemotingConfiguration.Configure("server.exe.config");

Console.WriteLine("The server is listening. Press Enter to exit....");
Console.ReadLine();

Console.WriteLine("GC'ing.");
GC.Collect();
GC.WaitForPendingFinalizers();

}
}


  表2:Server.exe.config源代码
<SYSTEM.RUNTIME.REMOTING>
<APPLICATION>
<SERVICE>
<ACTIVATED type="ClientActivatedType, RemoteType">
</SERVICE>
<CHANNELS>
<CHANNEL ref="http" port="8088">
</CHANNELS>
</APPLICATION>
</SYSTEM.RUNTIME.REMOTING>
</CONFIGURATION>




表3:RemoteType.cs源代码


using System;
using System.Runtime.Remoting.Lifetime;
using System.Security.Principal;

public class ClientActivatedType : MarshalByRefObject{

private int i;
// override the lease settings for this object
public override Object InitializeLifetimeService(){
return null;
}

public string RemoteMethod(){

// announce to the server that we've been called.
Console.WriteLine("ClientActivatedType.RemoteMethod called.");

// report our client identity name

i=this.GetHashCode();
return "RemoteMethod called. " + i;
}

public string RemoteMethod1(){
return "RemoteMethod1 called. " + i;

}
}
超级大笨狼 2006-06-12
  • 打赏
  • 举报
回复
做一个 exe 就可以了。

62,046

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

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