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

一个应用是否向nacos注册多个服务? #305

Open
MagicPurple7 opened this issue Jul 26, 2024 · 3 comments
Open

一个应用是否向nacos注册多个服务? #305

MagicPurple7 opened this issue Jul 26, 2024 · 3 comments

Comments

@MagicPurple7
Copy link

一个.Net6 应用同时有http和grpc服务,往nacos注册服务时,是否可以注册两个服务(服务名称不同,端口不同)?类似Consul注册服务
{ "ConsulRegister": { "IP": "10.16.0.13", "Port": "5003", "GroupName": "Message", "HealthCheckUrl": "HealthCheck", "Interval": 10, "Timeout": 5, "DeregisterCriticalServiceAfter": 20, "Tag": "3" }, "ConsulRegisterGPRC": { "IP": "10.16.0.13", "Port": "5103", "GroupName": "MessageGrpc", "Interval": 10, "Timeout": 5, "DeregisterCriticalServiceAfter": 20, "Tag": "1003" } }

@catcherwong
Copy link
Collaborator

下面的做法你可以参考一下:

  1. 注册成同一个服务,端口不一样,外加metadata进行判断
  2. 注册成两个服务,需要基于 nacos-sdk-charp 这个原始sdk进行封装,如何识别http/grpc/其他 。

@MagicPurple7
Copy link
Author

好的,感谢!我先用第一种做法实现看看。

@MagicPurple7
Copy link
Author

大佬,我使用第一种方法获取服务,程序运行到以下代码时,
var instance = await _nacosSvc.SelectOneHealthyInstance("Message", "DEFAULT_GROUP");
会将UserManerge 对象里的Token置空,未运行到这一句代码时,是有值的。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants