1

Setup is mono latest stable on raspberry pi, polling data from service on server with .NET 4.5.

My configuration for server side:

  <system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior name="vlcBehaviour">
          <serviceMetadata  httpGetEnabled="true" />
        </behavior>
      </serviceBehaviors>
    </behaviors>

    <services>
      <service name="ser.Serwys">
        <endpoint address="net.tcp://192.168.56.1:9070/WindowService" binding="netTcpBinding" bindingConfiguration="AnonymousTcpBinding"
                  contract="Window.Service.IWindowServiceHost" />
      </service>
    </services>

    <bindings>
      <netTcpBinding>
        <binding name="AnonymousTcpBinding" receiveTimeout="00:00:01"
                 sendTimeout="00:00:01"
                 maxBufferSize="1000"
                 maxConnections="100"
                 maxBufferPoolSize="100"
                 listenBacklog="200"
                 maxReceivedMessageSize="1000">
          <security mode="None" />
        </binding>
      </netTcpBinding>
    </bindings>
  </system.serviceModel>

On client side:

<system.serviceModel>
    <behaviors>
        <endpointBehaviors>
            <behavior name="maxItems">
                <dataContractSerializer maxItemsInObjectGraph="2147483646" />
            </behavior>
        </endpointBehaviors>
    </behaviors>
    <bindings>
        <netTcpBinding>
            <binding name="AnonymousTcpBinding" openTimeout="00:00:01" receiveTimeout="00:00:01" sendTimeout="00:00:01" maxBufferSize="1000" maxConnections="200" listenBacklog="200" maxReceivedMessageSize="1000">
                <security mode="None" />
            </binding>
        </netTcpBinding>
    </bindings>
    <client>
        <endpoint name="WindowService" address="net.tcp://192.168.56.1:9070/WindowService" binding="netTcpBinding" bindingConfiguration="AnonymousTcpBinding" contract="Window.Service.IWindowServiceHost" />
    </client>
</system.serviceModel>

Service contract:

namespace Window.Service
{
    [ServiceContract(
        Namespace = "http://window",
        Name = "WindowHost")]
    public interface IWindowServiceHost
    {
        [OperationContract]
        void Connect(int windowId);

        [OperationContract]
        void Disconnect();

        [OperationContract]
        DisplayData GetData();
    }
}

Implementation of service:

[ServiceBehavior(InstanceContextMode = InstanceContextMode.Single, ConcurrencyMode = ConcurrencyMode.Single)]
    public class Serwys:IWindowServiceHost

Method that is called:

    public DisplayData GetData()
    {
        Console.WriteLine("Called get data {0}:{1}:{2}",DateTime.Now.Minute,DateTime.Now.Second,DateTime.Now.Millisecond);
        return new DisplayData
        {
            BoxesInProgress = 1,
        };
    }

Call to GetData from client takes more and more time, don't know why. I have tested it on Ubuntu also, Mono is latest version here how I log it:

Stopwatch stp = new Stopwatch();
stp.Start();
var data = remote.GetData();
stp.Stop();
log.WarnFormat("Polling service took: {0} ms", stp.ElapsedMilliseconds);

Any explanations?? I think it is Mono bug, because setup is really basic no concurrency method called is dead simple, and polling times are going up.

I call it on timer elapse, and for test I call it every 10ms but it is growing even if I call it every second, but slower, and this only gives me more time before all crashes.

4

0 に答える 0