문제

.NET Remoting을 사용하고 있습니다.내 서버/호스터는 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()
        {

        }
    }
}

도움을 주셔서 감사합니다.

바카노

도움이 되었습니까?

해결책

SingleCall 유형으로 클라이언트가 호출할 때마다 SampleObject가 생성됩니다.이는 귀하의 개체에 결함이 있으며 개체가 무엇을 하는지 보여주지 않는다는 것을 의미합니다.공유 리소스나 잠금에 대한 종속성을 살펴봐야 합니다.원격 호출이 얼마나 멀리까지 가는지 확인하려면 SampleObject의 생성자에 디버그 아웃을 작성해 보세요.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top