dotnet / orleans

Cloud Native application framework for .NET
https://docs.microsoft.com/dotnet/orleans
MIT License
10.07k stars 2.03k forks source link

Question: Connect Orleans 2.0 Client to Orleans 1.3.1 Silos #2716

Closed gtakov closed 7 years ago

gtakov commented 7 years ago

Hi, I am fairly new when it comes to Orleans and I am doing some experiments using the framework. I have setup a silo project (hosted as an Azure Worker role) and a client (hosted in a separate App Service) connected by a virtual network. I am planning to port the client to .net core so I created a clean .net core web application and tried connecting it to the existing silo. The grain is really simple:

  1. Interface:
    public interface IGrainTest : IGrainWithGuidKey
    {
        Task<string> SayHello();
    }
  2. Grain implementation:
public class Grain1 : Grain, IGrainTest
{
        public Task<string> SayHello()
        {
            return Task.FromResult(String.Format("{0} - {1} - {2} Processors", Environment.MachineName, Environment.OSVersion, Environment.ProcessorCount));
        }
 }

Unfortunatelly I am getting an exception when initializing the Client:

System.NotSupportedException: 'SerializationTokenType of StringObjDict is not supported.'

Exception StackTrace:

at Orleans.Serialization.ILBasedSerializer.ReadType(SerializationTokenType token, BinaryTokenStreamReader reader, Type expectedType) at Orleans.Serialization.ILBasedSerializer.Deserialize(Type expectedType, BinaryTokenStreamReader reader) at Orleans.Serialization.SerializationManager.FallbackDeserializer(BinaryTokenStreamReader stream, Type expectedType) at Orleans.Serialization.SerializationManager.DeserializeInner(Type expected, BinaryTokenStreamReader stream) at Orleans.Serialization.BuiltInTypes.DeserializeOrleansResponse(Type expected, BinaryTokenStreamReader stream) at Orleans.Serialization.SerializationManager.DeserializeInner(Type expected, BinaryTokenStreamReader stream) at Orleans.Serialization.SerializationManager.Deserialize(Type t, BinaryTokenStreamReader stream) at Orleans.Runtime.Message.DeserializeBody(List1 bytes) at Orleans.Runtime.Message.get_BodyObject() at Orleans.Runtime.GrainReference.ResponseCallback(Message message, TaskCompletionSource1 context) --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Orleans.GrainClient.InternalInitialize(ClientConfiguration config)

Is the configuration that I am attempting to achieve (a .net core client (using the v2.0.0 preview packages) and a silo that uses Orleans 1.3.1) even possible? Are you planning to make that configuration possible or you will have to use the same version of Orleans in both Client and Silo?

jdom commented 7 years ago

Hi @gtakov, unfortunately you can't mix and match different versions of Orleans. Nevertheless, Orleans 2.0 is written in .NET Standard, so it supports the full .NET Framework too, not just .NET Core. Having said that, I'm not entirely sure having a client hosted in .NET Core and the silos in full .NET will work well together (my main concern is serialization, but in many cases it should work). We hope to get that scenario covered, but we would need people such as you helping us with some real world coverage, so we can fix issues if any along the way.