gpt4 book ai didi

c# - .net 核心 : Invalid property identifier character: {. 路径 'Logging',第 10 行,位置 2。Newtonsoft.Json.JsonTextReader.ParseProperty()

转载 作者:太空宇宙 更新时间:2023-11-03 22:50:07 24 4
gpt4 key购买 nike

我将 Angular CLI 添加到我的项目中,一切正常。然后我决定单击 Visual Studio 2017 顶部的小旗帜,这表明有 VS 2017 的新更新。我安装了它并重新启动了我的 Windows 10 PC。

现在它可以使用 F6 成功构建,但是当我在浏览器中 F5Ctrl+F5 我的 .net core mvc 应用程序时出现以下错误:

截图:https://imgur.com/wFFN1r8

An error occurred while starting the application.

JsonReaderException: Invalid property identifier character: {. Path 'Logging', line 10, position 2. Newtonsoft.Json.JsonTextReader.ParseProperty()

FormatException: Could not parse the JSON file. Error on line number '10': '}, {'. Microsoft.Extensions.Configuration.FileConfigurationProvider.Load(bool reload)

JsonReaderException: Invalid property identifier character: {. Path 'Logging', line 10, position 2. Newtonsoft.Json.JsonTextReader.ParseProperty() Newtonsoft.Json.Linq.JContainer.ReadContentFrom(JsonReader r, JsonLoadSettings settings) Newtonsoft.Json.Linq.JContainer.ReadTokenFrom(JsonReader reader, JsonLoadSettings options) Newtonsoft.Json.Linq.JObject.Load(JsonReader reader, JsonLoadSettings settings) Microsoft.Extensions.Configuration.Json.JsonConfigurationFileParser.Parse(Stream input) Microsoft.Extensions.Configuration.Json.JsonConfigurationProvider.Load(Stream stream)

我的 appsettings.json 文件如下所示:

{
"Logging": {
"IncludeScopes": false,
"LogLevel": {
"Default": "Warning"
}
}
}

我想不出任何其他 .json 文件会成为问题。我删除了我添加的 Angular 客户端应用程序文件夹,它仍然产生相同的错误。

我不知道从哪里开始尝试解决这个问题,Google 也没有提出任何其他具有相同问题的帖子。

建议?

最佳答案

@Jamie Taylor 想通了。

我没有看到的一个文件是“appsettings.Development.json”,因为它不会出现在解决方案资源管理器中,除非您展开 appsettings.json。

我有:

{
"Logging": {
"IncludeScopes": false,
"LogLevel": {
"Default": "Debug",
"System": "Information",
"Microsoft": "Information"
}
},
{
"AWS": {
"Profile": "Default",
"Region": "us-east-1"
}
}
}

它在同一天早些时候工作,我可以在我的 Windows 文件资源管理器中看到该文件在过去 2 周内没有更改。此 JSON 文件的格式不正确。因为我不再需要 AWS 的东西,所以我删除了那部分,现在它的工作方式是:

{
"Logging": {
"IncludeScopes": false,
"LogLevel": {
"Default": "Debug",
"System": "Information",
"Microsoft": "Information"
}
}
}

关于c# - .net 核心 : Invalid property identifier character: {. 路径 'Logging',第 10 行,位置 2。Newtonsoft.Json.JsonTextReader.ParseProperty(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47804926/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com