问题: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; }
}
若有疑问可咨询: