.NET Remoting Server 仅处理一个请求
我正在使用 .NET 远程处理。 我的服务器/主机是 Windows 服务。 有时它会工作得很好,有时它会处理一个请求,然后不再处理(直到我重新启动它)。 它作为 Windows 服务运行 以下是来自 Windows 服务的代码:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Tcp;
using System.ServiceProcess;
using System.Text;
using Remoting;
namespace CreateReview
{
public partial class Service1 : ServiceBase
{
public Service1()
{
InitializeComponent();
}
readonly TcpChannel channel = new TcpChannel(8180);
protected override void OnStart(string[] args)
{
// Create an instance of a channel
ChannelServices.RegisterChannel(channel, false);
// Register as an available service with the name HelloWorld
RemotingConfiguration.RegisterWellKnownServiceType(
typeof(SampleObject),
"SetupReview",
WellKnownObjectMode.SingleCall);
}
protected override void OnStop()
{
}
}
}
感谢您提供的任何帮助。
瓦卡诺
I am using .NET Remoting. My server/hoster is a Windows Service. It will sometimes work just fine and other times it will process one request and then it does not process any more (until I restart it). It is running as a Windows service Here is the code from the Windows Service:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Tcp;
using System.ServiceProcess;
using System.Text;
using Remoting;
namespace CreateReview
{
public partial class Service1 : ServiceBase
{
public Service1()
{
InitializeComponent();
}
readonly TcpChannel channel = new TcpChannel(8180);
protected override void OnStart(string[] args)
{
// Create an instance of a channel
ChannelServices.RegisterChannel(channel, false);
// Register as an available service with the name HelloWorld
RemotingConfiguration.RegisterWellKnownServiceType(
typeof(SampleObject),
"SetupReview",
WellKnownObjectMode.SingleCall);
}
protected override void OnStop()
{
}
}
}
Thanks for any help offered.
Vaccano
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
作为 SingleCall 类型,将为客户端进行的每次调用创建 SampleObject。 这对我来说意味着你的对象有问题,而你没有展示它的作用。 您需要查看它对共享资源或锁的任何依赖性。 尝试在 SampleObject 的构造函数中编写一些调试,以查看远程调用进行到什么程度。
as a SingleCall type, your SampleObject will be created for every call the client makes. This suggests to me that your object is at fault, and you don't show what it does. You need to look at any dependancies it has on shared resources orlocks. Try writing some debug out in the SampleObject's constructor to see how far the remoting call gets.