OrleansContrib / SignalR.Orleans

SignalR backend based on Orleans.
MIT License
290 stars 62 forks source link

Using cohost #98

Open shersh opened 5 years ago

shersh commented 5 years ago

Is it possible to use this packet without ClientBuilder, when orleans backend is co-hosted with ASP.NET API ?

stephenlautier commented 5 years ago

In our projects we are using this in a generic host orleans and hosted along with an aspnet web similar to this https://github.com/dotnet/orleans/blob/master/Samples/2.3/HealthCheckSample/src/Silo/Program.cs and it does work.

Sometimes after switching to generic host we are getting the following: https://github.com/OrleansContrib/SignalR.Orleans/issues/89 however we use it in production and most of the time it does work, not sure if its related or its misconfiguration on our end tho

zeus82 commented 4 years ago

I also trying to use this when an orleans backend is co-hosted with ASP.NET API, but whenever I class IGrainFactory.GetGrain<>, I get an error saying ''System.ArgumentException: 'Cannot find an implementation class for grain interface: IMyGrain. Make sure the grain assembly was correctly deployed and loaded in the silo.'"

If I remove siloBuilder.UseSignalR(), the my GetGrain call works. I can also reproduce the problem with the Co-Host example found here

srivathsah commented 4 years ago

@zeus82 Check if this solves the issue

xrkraken commented 4 years ago

@shersh Have you solved this problem? Can you tell me the solution

zeus82 commented 4 years ago

I fixed my issue by adding the following:

siloBuilder.ConfigureApplicationParts(parts => parts.AddApplicationPart(typeof(MyGrain).Assembly).WithReferences());

From what I can tell, you need to do this because SignalR adds itself as an application part.

xrkraken commented 4 years ago

@zeus82 I have this configuration in the code. With the addition of signalr, there is no way to access it. Just remove the code related to signalr. But I can't find the cause of the error at the moment

zeus82 commented 4 years ago

Can you share the exact error your getting?

Also, what version of ASP are you using?

xrkraken commented 4 years ago

of course, i'm using asp.net core 3.0,Microsoft.Orleans.CodeGenerator.MSBuild v3.1.6,error:Cannot find an implementation class for grain interface,

zeus82 commented 4 years ago

So this doesn't actually work with ASP Core 3, it only works with 2. I have fixed it to work with 3. See this Repo: https://github.com/zeus82/SignalR.Orleans

I opened a PR to update this repo, but I haven't gotten a response... https://github.com/OrleansContrib/SignalR.Orleans/pull/116

Can you also share your silobuilder code?