dotnet / orleans

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

environment connections #4624

Closed a641545621 closed 6 years ago

a641545621 commented 6 years ago

server var siloPort = 20028; int gatewayPort = 30020; var siloAddress = IPAddress.Parse("0.0.0.0");// IPAddress.Loopback; var builder = new SiloHostBuilder() .UseEnvironment("Development") .Configure(options => { options.ClusterId = "test1"; options.ServiceId = "test1"; }) .UseDevelopmentClustering(options => options.PrimarySiloEndpoint = new IPEndPoint(siloAddress, siloPort)) .ConfigureEndpoints(siloAddress, siloPort, gatewayPort) .ConfigureApplicationParts(parts => parts.AddApplicationPart(typeof(Test).Assembly).WithReferences());

client var siloAddress = "127.0.0.1"; //IPAddress.Loopback; var gatewayPort = 30020; var uri = (new IPEndPoint(IPAddress.Parse(siloAddress), gatewayPort)).ToGatewayUri(); client = new ClientBuilder() .ConfigureDefaults() // .UseLocalhostClustering(gatewayPort) .Configure(opt => { opt.ClusterId = "test1"; opt.ServiceId = "test1"; }) ////集群 .UseStaticClustering(options => options.Gateways.Add(uri))//集群
.ConfigureApplicationParts(parts => parts.AddApplicationPart(typeof(ITest).Assembly).WithReferences())

server var siloAddress = IPAddress.Parse("0.0.0.0"); Can connect but cannot get information var siloAddress=IPAddress.Loopback; Cannot connect service Should be server port listening failed

can you tell me the reason? I want to test the deployment of the production environment,A silo A client silo is deployed on the server,Local test is normal access

a641545621 commented 6 years ago

client var siloAddress = "192.168.1.250";
Client access address Fill in intranet address can not access normally 94vbidke s5 _ h 6jw z5 e6 ksvnozwaz_ lv9x59u 4

ReubenBond commented 6 years ago

对不起,我不明白,但是我觉得你应该用listenOnAnyHostAddress: true:

builder.ConfigureEndpoints(
  advertisedIP: siloAddress,
  siloPort: siloPort,
  gatewayPort: gatewayPort,
  listenOnAnyHostAddress: true)

If you use UseDevelopmentClustering then advertisedIP is not important for clients, only other silos. You can use string hostname override of ConfigureEndpoints and set it to "localhost". If you do that, it will try to pick an intranet IP for you (must also set listenOnAnyHostAddress: true!):

builder.ConfigureEndpoints(
  hostname: "localhost",
  siloPort: siloPort,
  gatewayPort: gatewayPort,
  listenOnAnyHostAddress: true)
a641545621 commented 6 years ago

normal circumstances 1 2 3

The first kind of abnormal situation 4 5 8

The second abnormal situation 6 7

There are two problems, 1.IPAddress.Parse("192.168.1.250") Connection failed 2.port:30020 Connection failed

I want to find out why and how to solve it

ReubenBond commented 6 years ago

Could you upload your broken code, @a641545621? I'll test locally

ReubenBond commented 6 years ago

Why is it connecting to 30020 when the silo is configured to listen on 30000?

a641545621 commented 6 years ago

https://github.com/a641545621/orleans-test2/blob/master/host.rar the silo is configured to listen on 30020

ReubenBond commented 6 years ago

@a641545621 I see you're targeting CoreRT. CoreRT is not supported yet

ReubenBond commented 6 years ago

After removing the <RuntimeIdentifier> element from your project and removing unused packages, your code works for me

ReubenBond commented 6 years ago

@a641545621 please reopen this issue if you are still seeing this error.