.NET Remoting Server 仅处理一个请求

发布于 2024-07-05 05:39:10 字数 1241 浏览 1 评论 0原文

我正在使用 .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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

撩起发的微风 2024-07-12 05:39:10

作为 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文