Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ServiceFabric : A cluster id has not been configured, BUG #4226

Closed
hanxinimm opened this issue Mar 15, 2018 · 6 comments
Closed

ServiceFabric : A cluster id has not been configured, BUG #4226

hanxinimm opened this issue Mar 15, 2018 · 6 comments
Assignees
Milestone

Comments

@hanxinimm
Copy link

what's error with me?
how to do it?

var listener = OrleansServiceListener.CreateStateless(
                (serviceContext, builder) =>
                {
                    // Optional: use Service Fabric for cluster membership.
                     builder.UseServiceFabricClustering(serviceContext);

                    var config = new ClusterConfiguration();

                    config.Globals.ReminderServiceType = ReminderServiceProviderType.Disabled;

                    // Service Fabric manages port allocations, so update the configuration using those ports.
                    builder.Configure<EndpointOptions>(options => {
                        options.AdvertisedIPAddress = IPAddress.Loopback;
                        options.ConfigureFromServiceContext(serviceContext);
                    });

                    builder.AddIncomingGrainCallFilter<ExceptionConversionFilter>();

                    // Tell Orleans to use this configuration.
                    builder.UseConfiguration(config);

                    builder.ConfigureServices(ConfigureDelegate);

                    // Add your application assemblies.
                    builder.ConfigureApplicationParts(parts =>
                    {
                        // Alternative: add all loadable assemblies in the current base path (see AppDomain.BaseDirectory).
                        parts.AddFromApplicationBaseDirectory().WithCodeGeneration();
                    });
                });
@ReubenBond
Copy link
Member

You need to call builder.Configure<ClusterOptions>(options => options.ClusterId = "your id");

@hanxinimm
Copy link
Author

@ReubenBond

it remove this code

builder.UseConfiguration(config);

it work good

ServiceFabric don't need old method UseConfiguration?

 var listener = OrleansServiceListener.CreateStateless(
                (serviceContext, builder) =>
                {

                    // Optional: configure logging.
                    builder.ConfigureLogging(logging => logging.AddDebug());


                    builder.AddMemoryGrainStorage("MemoryStore");

                    builder.Configure<EndpointOptions>(options =>
                    {
                        options.AdvertisedIPAddress = System.Net.IPAddress.Loopback;
                        options.ConfigureFromServiceContext(serviceContext);
                    });



                    builder.UseServiceFabricClustering(serviceContext);

                    builder.ConfigureServices(ConfigureDelegate);

                    // Add your application assemblies.
                    builder.ConfigureApplicationParts(parts =>
                    {
                        // Alternative: add all loadable assemblies in the current base path (see AppDomain.BaseDirectory).
                        parts.AddFromApplicationBaseDirectory().WithCodeGeneration();
                    });
                });

@ReubenBond
Copy link
Member

That's correct, Service Fabric does not require the old configuration method anymore

@hanxinimm hanxinimm changed the title ServiceFabric : A cluster id has not been configured, ServiceFabric : A cluster id has not been configured, BUG Mar 15, 2018
@hanxinimm
Copy link
Author

hanxinimm commented Mar 15, 2018

@ReubenBond

it not work , the bug is contingencies~

builder.Configure<ClusterOptions>(options => options.ClusterId = "SeekerApp-StatelessCommandService");

image

image

@ReubenBond ReubenBond reopened this Mar 15, 2018
@sergeybykov sergeybykov added this to the Triage milestone Mar 15, 2018
@ReubenBond
Copy link
Member

This will be fixed in the next release, it was fixed in #4211.
As a work-around, you can configure the endpoints more explicitly, like this:

builder.Configure<EndpointOptions>(options =>
{
    options.AdvertisedIPAddress = IPAddress.Loopback;
    options.ConfigureFromServiceContext(serviceContext);
    options.SiloListeningEndpoint = new IPEndPoint(IPAddress.Any, options.SiloPort);
    options.GatewayListeningEndpoint = new IPEndPoint(IPAddress.Any, options.GatewayPort);
});

@hanxinimm
Copy link
Author

hanxinimm commented Mar 16, 2018

@ReubenBond

Both the server and the client need to add this code

server :

builder.Configure<ClusterOptions>(options =>
                    {
                        options.ClusterId = serviceContext.ServiceName.ToString();
                    });

client:

     return new ClientBuilder()
                .UseServiceFabricClustering(new Uri(serviceName))
                .Configure<ClusterOptions>(options => options.ClusterId = serviceName)
                .ConfigureApplicationParts(parts => parts.AddFromApplicationBaseDirectory().WithCodeGeneration())
                .Build();
        

it work good

I don't think the error message is clear enough.

@ghost ghost locked as resolved and limited conversation to collaborators Sep 27, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants