NetCore去注冊Eureka


首先先安裝nuget組件:Steeltoe.Discovery.ClientCore 
然后在ConfigureServices中進行注入
services.AddDiscoveryClient(Configuration);

Configure中引用
app.UseDiscoveryClient();


Appsettings中編寫

 1 {
 2 "Logging": {
 3 "IncludeScopes": false,
 4 "LogLevel": {
 5 "Default": "Warning"
 6 }
 7 },
 8 "spring": {
 9 "application": {
10 "name": "order11111"  //注入的名稱
11 }
12 },
13 "eureka": {
14 
15 "client": {
16 "serviceUrl": "http://192.168.130.132:8761/eureka/",
17 "shouldRegisterWithEureka": true,//默認值是true
18 "shouldFetchRegistry": false,//設置指示客戶端不要獲取注冊表,因為該應用無需發現服務。它只想注冊服務
19 "validate_certificates": false
20 },
21 "instance": {
22 "hostName": "192.168.130.148",//默認是在運行時自動確認的 不加上這個的話網關找不到服務
23 "port": 14802,//設置該服務中注冊的端口
24 "leaseRenewalIntervalInSeconds": 30,
25 "leaseExpirationDurationInSeconds": 90
26 }
27 
28 
29 }
30 }

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM