Pregunta

Estoy usando .NET Remoting.Mi servidor/hoster es un servicio de Windows.A veces funcionará bien y otras veces procesará una solicitud y luego no procesará más (hasta que lo reinicie).Se ejecuta como un servicio de Windows. Aquí está el código del servicio de 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()
        {

        }
    }
}

Gracias por cualquier ayuda ofrecida.

vacano

¿Fue útil?

Solución

Como tipo SingleCall, su SampleObject se creará para cada llamada que realice el cliente.Esto me sugiere que tu objeto tiene la culpa y no muestras lo que hace.Debe observar las dependencias que tiene en los recursos compartidos o en los bloqueos.Intente escribir algo de depuración en el constructor de SampleObject para ver hasta dónde llega la llamada remota.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top