简体   繁体   English

.NET Remoting Server仅处理一个请求

[英].NET Remoting Server Only processes One request

I am using .NET Remoting. 我正在使用.NET Remoting。 My server/hoster is a Windows Service. 我的服务器/主机是Windows服务。 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: 它作为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()
        {

        }
    }
}

Thanks for any help offered. 感谢您提供的任何帮助。

Vaccano 瓦卡诺

as a SingleCall type, your SampleObject will be created for every call the client makes. 作为SingleCall类型,将为客户端进行的每个调用创建SampleObject。 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. 您需要查看它对共享资源orlock的任何依赖关系。 Try writing some debug out in the SampleObject's constructor to see how far the remoting call gets. 尝试在SampleObject的构造函数中编写一些调试信息,以查看远程调用能达到的程度。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM