One or more errors occurred. (Not connected to a gateway)
Hi,
We are running 2 small sized worker roles (Orleans 2.0) and client app service (ASP.Net core) also networked as per the documentation App service and orleans silo(cloudservice) share same vNET and configured the subnet of vNET to Network security group. Both workerrole and appservice use same clusterId and serviceId.
While trying to connect from azure app service(client) to orleans silo(workerrole) am getting an error in client as "Not connected to a gateway" can someone help me what configurations should do to resolve this?
Below is the error log
An error occurred while starting the application. AggregateException: One or more errors occurred. (Not connected to a gateway) System.Threading.Tasks.Task.ThrowIfExceptional(bool includeTaskCanceledExceptions)
OrleansException: Not connected to a gateway Orleans.Messaging.ClientMessageCenter.GetLiveGatewaySiloAddress()
AggregateException: One or more errors occurred. (Not connected to a gateway)
System.Threading.Tasks.Task.ThrowIfExceptional(bool includeTaskCanceledExceptions)
System.Threading.Tasks.Task.Wait(int millisecondsTimeout, CancellationToken cancellationToken)
NetCoreSPA.Startup+<>c__DisplayClass5_0.
Show raw exception details
OrleansException: Not connected to a gateway
Orleans.Messaging.ClientMessageCenter.GetLiveGatewaySiloAddress()
Orleans.Messaging.ClientMessageCenter.GetImplicitStreamSubscriberTable(IInternalGrainFactory grainFactory)
Orleans.OutsideRuntimeClient+
Show raw exception details
Orleans.Runtime.OrleansException: Not connected to a gateway
at Orleans.Messaging.ClientMessageCenter.GetLiveGatewaySiloAddress()
at Orleans.Messaging.ClientMessageCenter.GetImplicitStreamSubscriberTable(IInternalGrainFactory grainFactory)
at Orleans.OutsideRuntimeClient.

the documentation link you have there is for Orleans 1.5 and before . Here is the 2.0 link : http://dotnet.github.io/orleans/Documentation/Migration/MigrationAzure2.0.html
And we also have azure worker role sample upgradedto use 2.0, which can serve as a good guide.
My suspection for the exception is your clustering config isn't correct. It's likely because you followed the old docs. But without your config code, I cannot be sure. So I suggest you look at the new docs and sample, go from there. Welcome to post further question if you have on the new 2.0 docs
@xiazen Thanks for the suggestion, Documentation which i was referring was from the Orleans 2.0 Documentation


We are following the same example (AzureWorkerRoleSample) which you referenced in your comment
Here is the Silo configurations from my code
private Task RunAsync(CancellationToken cancellationToken)
{
try
{
var proxyPort = RoleEnvironment.CurrentRoleInstance.InstanceEndpoints["OrleansProxyEndpoint"].IPEndpoint.Port;
var siloEndpoint = RoleEnvironment.CurrentRoleInstance.InstanceEndpoints["OrleansSiloEndpoint"].IPEndpoint;
var connectionString = RoleEnvironment.GetConfigurationSettingValue("DataConnectionString");
var deploymentId = RoleEnvironment.DeploymentId;
var builder = new SiloHostBuilder()
.Configure<ClusterOptions>(options =>
{
options.ClusterId = "dev";
options.ServiceId = "AzureWorkerRoleSample";
})
.Configure<SiloOptions>(Options=>Options.SiloName=this.Name)
.Configure<EndpointOptions>(options=> { options.AdvertisedIPAddress = IPAddress.Loopback; options.SiloPort = 11111;options.GatewayPort = 30000; })
.UseAzureStorageClustering(options => options.ConnectionString = connectionString)
.UseDashboard(Options=> { });
siloHost = builder.Build();
}
catch(Exception ex)
{
telemetry.TrackException(ex);
}
return siloHost.StartAsync(cancellationToken);
}
Here is my Client application(ASP.Net Core) startup class where we initialize grain
`public class Startup { TelemetryClient telemetry = new TelemetryClient(); public Startup(IConfiguration configuration) { TelemetryConfiguration.Active.InstrumentationKey = "myInstrumentationKey"; Configuration = configuration; }
public IConfiguration Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
string connectionString = "DefaultEndpointsProtocol=https;AccountName=<my Account Name>;AccountKey=<my account key>;EndpointSuffix=core.windows.net";
#region ORLEANS Grainfactory configuration
services.AddSingleton<IGrainFactory>(sp =>
{
var builder = new ClientBuilder()
.UseAzureStorageClustering(options => options.ConnectionString = connectionString)
//.LoadConfiguration()
.Configure<ClusterOptions>(options =>
{
options.ClusterId = "dev";
options.ServiceId = "AzureWorkerRoleSample";
})
.ConfigureLogging(logging => logging.AddConsole())
.Build();
builder.Connect().Wait();
return builder;
});
#endregion
services.AddMvc();
services.AddCors(o => o.AddPolicy("AppPolicy", builder =>
{
builder.AllowAnyOrigin()
.AllowAnyMethod()
.AllowAnyHeader();
}));
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, Microsoft.AspNetCore.Hosting.IHostingEnvironment env)
{
#region adding IgrainFactory to app
app.ApplicationServices.GetService<IGrainFactory>();
#endregion
if (env.IsDevelopment())
{
app.UseBrowserLink();
app.UseDeveloperExceptionPage();
}
// Middleware to Handle Client Side Routes
app.Use(async (context, next) =>
{
await next();
if (context.Response.StatusCode == 404 && !Path.HasExtension(context.Request.Path.Value))
{
context.Request.Path = "/index.html";
context.Response.StatusCode = 200;
await next();
}
});
DefaultFilesOptions options = new DefaultFilesOptions();
options.DefaultFileNames.Clear();
options.DefaultFileNames.Add("/index.html");
app.UseDefaultFiles(options);
app.UseStaticFiles();
app.UseFileServer(enableDirectoryBrowsing: false);
app.UseMvc();
}
}
} `
We are able to run the application smoothly in local environment.
But when we deploy client as app service and silo as worker role (cloud service) by configuring the vNet for app service and cloud service communication is not happening between client and silo.
@madhuchowlur could you test that the client VMs have network connectivity to the silo VMs? Also verify that the firewall is not blocking communication.
Closing due to inactivity. Please reopen if needed 🙂