懂得把remoting写在windows服务中的进来帮我看一下

philipsslg 2005-03-07 04:53:07
我写了windows服务程序做为服务端
protected override void OnStart(string[] args)
{
th = new Thread(new ThreadStart(ServiceThread));
th.Start();
//RemotingConfiguration.Configure("SimpleServer.exe.config");
}
void ServiceThread()
{
RemotingConfiguration.Configure("SimpleServer.exe.config");
}
客户端没法正常运行。
如果服务端写成控制台程序
static void Main(string[] args)
{
RemotingConfiguration.Configure("SimpleServer.exe.config");

Console.WriteLine("Press return to exit");
Console.ReadLine();
}
客户端就正常。
请问什么原因???

...全文
128 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
LoveCherry 2005-03-07
  • 打赏
  • 举报
回复
看看
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetsec/html/SecNetHT15.asp
philipsslg 2005-03-07
  • 打赏
  • 举报
回复
SimpleServer.exe.config配置文件是
<configuration>
<system.runtime.remoting>
<application name="SimpleServer">
<service>
<wellknown mode="SingleCall" type="Wrox.Samples.MyRemoteObject, MyRemoteObject" objectUri="MyRemoteObject" />
</service>
<channels>
<channel ref="tcp server" port="9000" />
</channels>
</application>
</system.runtime.remoting>
</configuration>
remoting程序的代码为:
using System;

namespace Wrox.Samples
{
/// <summary>
/// Summary description for Class1.
/// </summary>
public class MyRemoteObject : System.MarshalByRefObject
{
public MyRemoteObject()
{
Console.WriteLine("Constructor called");
}

public string Hello()
{
Console.WriteLine("Hello called");
return "Hello, .NET Client!";
}
}
}


110,538

社区成员

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

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

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