dotnet / orleans

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

Orleans Membership using SQLServer fails in .Net Core #6203

Closed ALEXR92 closed 4 years ago

ALEXR92 commented 4 years ago

Hi, I am trying to migrate our silo project into a .Net Core one but I am facing a new exception that I didn't have when using Framework 4.7.2. The exception is raised creating the membership using SQL Server and says:

_The keyword 'asynchronous processing' is not supported on this platform. at System.Data.SqlClient.SqlConnectionString.ThrowUnsupportedIfKeywordSet(String keyword) at System.Data.SqlClient.SqlConnectionString..ctor(String connectionString) at System.Data.SqlClient.SqlConnectionFactory.CreateConnectionOptions(String connectionString, DbConnectionOptions previous) at System.Data.ProviderBase.DbConnectionFactory.GetConnectionPoolGroup(DbConnectionPoolKey key, DbConnectionPoolGroupOptions poolOptions, DbConnectionOptions& userConnectionOptions) at System.Data.SqlClient.SqlConnection.ConnectionString_Set(DbConnectionPoolKey key) at System.Data.SqlClient.SqlConnection.set_ConnectionString(String value) at Orleans.Clustering.AdoNet.Storage.DbConnectionFactory.CreateConnection(String invariantName, String connectionString) at Orleans.Clustering.AdoNet.Storage.RelationalStorage.ExecuteAsync[TResult](String query, Action1 parameterProvider, Func5 executor, Func4 selector, CancellationToken cancellationToken, CommandBehavior commandBehavior) at Orleans.Clustering.AdoNet.Storage.RelationalStorage.ReadAsync[TResult](String query, Action1 parameterProvider, Func`4 selector, CancellationToken cancellationToken, CommandBehavior commandBehavior) at Orleans.Clustering.AdoNet.Storage.RelationalOrleansQueries.CreateInstance(String invariantName, String connectionString, IGrainReferenceConverter grainReferenceConverter) at Orleans.Runtime.MembershipService.AdoNetClusteringTable.InitializeMembershipTable(Boolean tryInitTableVersion) at Orleans.Runtime.MembershipService.MembershipTableManager.Start() at Orleans.Runtime.MembershipService.MembershipTableManager.<>c__DisplayClass53_0.<<Orleans-ILifecycleParticipant-Participate>gOnRuntimeGrainServicesStart|0>d.MoveNext() --- End of stack trace from previous location where exception was thrown --- at Orleans.Runtime.SiloLifecycleSubject.MonitoredObserver.OnStart(CancellationToken ct) at Orleans.LifecycleSubject.gCallOnStart|7_0(Int32 stage, OrderedObserver observer, CancellationToken cancellationToken) at Orleans.LifecycleSubject.OnStart(CancellationToken ct) at Orleans.Runtime.Scheduler.AsyncClosureWorkItem.Execute() at Orleans.Runtime.Silo.StartAsync(CancellationToken cancellationToken) at Orleans.Hosting.SiloWrapper.StartAsync(CancellationToken cancellationToken) at SiloWorkerService.SiloWorker.StartAsync(CancellationToken cancellation) in D:\Dev\Alex\DevNew\PRICING\LFService\Developement\SiloWorkerService\SiloWorker.cs:line 126 at Microsoft.Extensions.Hosting.Internal.Host.StartAsync(CancellationToken cancellationToken) at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token) at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token) at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.Run(IHost host)

I already tried updating Orleans nuget packages to the latest version (3.0.2) and also system.data.SqlClient (4.8.0) but doesn't seem to fix it. Does anyone have an idea ?

sergeybykov commented 4 years ago

Tagging @veikkoeeva in the new year. 🙂

veikkoeeva commented 4 years ago

As per the exception, it looks like the problem is parameter asynchronous processing in the connection string, some more information at https://docs.microsoft.com/en-us/dotnet/framework/data/adonet/asynchronous-programming. This parameter was ignored after .NET 4.5 update, I think, and it appears removed altogether in .NET Core.

ALEXR92 commented 4 years ago

That's it!! Removed Asynchronous Processing=True; from the connection string and now it works perfectly. Thank you