問題:Self referencing loop detected for property 'Value' with type 'xxx'. Path ''json
場景:.net core環境中使用release時,調用appsettings.json文件內容時報錯,錯誤內容如上。app
源代碼以下:oop
Startup:services.Configure<TestClass>(_configuration.GetSection("xxx"));this
public class TestClass : IOptions<TestClass>spa
{
public TestClass Value => this;.net
public double Lng { get; set; }對象
}ci
現對象改成以下可解決問題:get
public class TestClass : IOptions<TestClass>it
{
[JsonIgnore]
public TestClass Value => this;
public double Lng { get; set; }
}
若有疑問可諮詢: