无法在新闻应用中查看新闻列表(数据类型)

问题描述 投票:0回答:1

我们正在使用2sxc中的新闻应用程序,它运行良好,我们可以添加和编辑文章。 但是,当我们使用管理文章链接(“contentitems?contentType=News”)时。 其中(至少)一篇文章似乎存在一些损坏的数据。 当我们使用 F12 检查时,出现以下错误:

{
"Message": "An error has occurred.",
"ExceptionMessage": "The 'ObjectContent`1' type failed to serialize the response body for content type 'application/json; charset=utf-8'.",
"ExceptionType": "System.InvalidOperationException",
"StackTrace": null,
"InnerException": {
    "Message": "An error has occurred.",
    "ExceptionMessage": "Unable to translate Unicode character \\uD835 at index 121 to specified code page.",
    "ExceptionType": "System.Text.EncoderFallbackException",
    "StackTrace": "   at System.Text.EncoderExceptionFallbackBuffer.Fallback(Char charUnknown, Int32 index)\r\n   at System.Text.EncoderFallbackBuffer.InternalFallback(Char ch, Char*& chars)\r\n   at System.Text.UTF8Encoding.GetBytes(Char* chars, Int32 charCount, Byte* bytes, Int32 byteCount, EncoderNLS baseEncoder)\r\n   at System.Text.EncoderNLS.GetBytes(Char* chars, Int32 charCount, Byte* bytes, Int32 byteCount, Boolean flush)\r\n   at System.Text.EncoderNLS.GetBytes(Char[] chars, Int32 charIndex, Int32 charCount, Byte[] bytes, Int32 byteIndex, Boolean flush)\r\n   at System.IO.StreamWriter.Flush(Boolean flushStream, Boolean flushEncoder)\r\n   at System.IO.StreamWriter.Write(Char value)\r\n   at Newtonsoft.Json.JsonTextWriter.WriteEnd(JsonToken token)\r\n   at Newtonsoft.Json.JsonWriter.AutoCompleteClose(JsonContainerType type)\r\n   at Newtonsoft.Json.JsonWriter.WriteEndObject()\r\n   at Newtonsoft.Json.JsonWriter.WriteEnd(JsonContainerType type)\r\n   at Newtonsoft.Json.JsonWriter.WriteEnd()\r\n   at Newtonsoft.Json.JsonWriter.AutoCompleteAll()\r\n   at Newtonsoft.Json.JsonTextWriter.Close()\r\n   at Newtonsoft.Json.JsonWriter.Dispose(Boolean disposing)\r\n   at Newtonsoft.Json.JsonWriter.System.IDisposable.Dispose()\r\n   at System.Net.Http.Formatting.BaseJsonMediaTypeFormatter.WriteToStream(Type type, Object value, Stream writeStream, Encoding effectiveEncoding)\r\n   at System.Net.Http.Formatting.JsonMediaTypeFormatter.WriteToStream(Type type, Object value, Stream writeStream, Encoding effectiveEncoding)\r\n   at System.Net.Http.Formatting.BaseJsonMediaTypeFormatter.WriteToStream(Type type, Object value, Stream writeStream, HttpContent content)\r\n   at System.Net.Http.Formatting.BaseJsonMediaTypeFormatter.WriteToStreamAsync(Type type, Object value, Stream writeStream, HttpContent content, TransportContext transportContext, CancellationToken cancellationToken)\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Tracing.ITraceWriterExtensions.<TraceBeginEndAsyncCore>d__24.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.WebHost.HttpControllerHandler.<WriteBufferedResponseContentAsync>d__1b.MoveNext()"
}

}

对此我们能做些什么吗?有已知的解决方案吗?

json.net dotnetnuke 2sxc
1个回答
0
投票

这不是一个常见问题。

对我来说,听起来

System.Text.Json
有序列化问题,但这可能是由生成异常之前的某些事情引起的,这可能是主要问题。

我建议您检查 2sxc 服务器见解,看看您对该特定 API 调用是否有任何问题 - 请参阅 https://go.2sxc.org/insights

© www.soinside.com 2019 - 2024. All rights reserved.