0
나머지 API를 사용하여 Eureka 등록 서비스에 .net 커넥터를 쓰고 싶습니다. 아래와 같이 json 형식을 요구하고 구성 클래스에서 json을 생성하려고합니다. { "$": "8443", "@enabled": "true"},C# json이 속성과 직렬화합니다.
과 같이 json의 beginnnig에서 "securePort"와 같은 속성과 같은 속성을 직렬화하는 방법을 찾을 수 없습니다. 유레카에 필요한json으로 : 예상
{
"instance": {
"hostName": "WKS-SOF-L011",
"app": "com.automationrhapsody.eureka.app",
"vipAddress": "com.automationrhapsody.eureka.app",
"secureVipAddress": "com.automationrhapsody.eureka.app"
"ipAddr": "10.0.0.10",
"status": "STARTING",
"port": {"$": "8080", "@enabled": "true"},
"securePort": {"$": "8443", "@enabled": "true"},
"healthCheckUrl": "http://WKS-SOF-L011:8080/healthcheck",
"statusPageUrl": "http://WKS-SOF-L011:8080/status",
"homePageUrl": "http://WKS-SOF-L011:8080",
"dataCenterInfo": {
"@class": "com.netflix.appinfo.InstanceInfo$DefaultDataCenterInfo",
"name": "MyOwn"
},
}
}
내 수업 그게 전부가 직렬화 후 아래의 JSON을 생성 (내가 newtonsoft.json 사용) :
public class Port
{
public string PortName { get; set; }
[JsonProperty("enabled")]
public bool Enabled { get; set; }
}
public class DataCenterInfo
{
[JsonProperty("class")]
public string Class { get; set; }
[JsonProperty("name")]
public string Name { get; set; }
}
public class EurekaRegisterParams
{
[JsonProperty("instanceId")]
public string InstanceId { get; set; }
[JsonProperty("hostName")]
public string HostName { get; set; }
[JsonProperty("app")]
public string App { get; set; }
[JsonProperty("ipAddr")]
public string IpAddr { get; set; }
[JsonProperty("status")]
public string Status { get; set; }
[JsonProperty("port")]
public Port Port { get; set; }
[JsonProperty("securePort")]
public Port SecurePort { get; set; }
[JsonProperty("countryId")]
public string CountryId { get; set; }
[JsonProperty("dataCenterInfo")]
public DataCenterInfo DataCenterInfo { get; set; }
[JsonProperty("homePageUrl")]
public string HomePageUrl { get; set; }
[JsonProperty("statusPageUrl")]
public string StatusPageUrl { get; set; }
[JsonProperty("healthCheckUrl")]
public string HealthCheckUrl { get; set; }
}
''Port' 엔티티의'[JsonProperty ("$")]'를'PortName' 속성에 추가하려고 시도 했습니까? – Venky