在 Windows Server 2016 英文版上跑 .NET Core 3.0 Preview 8 ,在日志中发现很多"Unable to translate bytes [C8] at index 6 from specified code page to Unicode" 这样的错误,请问如何解决?
Microsoft.AspNetCore.Server.IIS.Core.IISHttpServer
System.Text.DecoderFallbackException: Unable to translate bytes [B6] at index 6 from specified code page to Unicode.
at System.Text.DecoderExceptionFallbackBuffer.Throw(Byte[] bytesUnknown, Int32 index)
at System.Text.DecoderExceptionFallbackBuffer.Fallback(Byte[] bytesUnknown, Int32 index)
at System.Text.Encoding.GetCharCountWithFallback(ReadOnlySpan`1 bytes, Int32 originalBytesLength, DecoderNLS decoder)
at System.Text.Encoding.GetCharCountWithFallback(Byte* pBytesOriginal, Int32 originalByteCount, Int32 bytesConsumedSoFar)
at System.Text.UTF8Encoding.GetCharCount(Byte* bytes, Int32 count)
at System.String.CreateStringFromEncoding(Byte* bytes, Int32 byteLength, Encoding encoding)
at System.Text.Encoding.GetString(ReadOnlySpan`1 bytes)
at Microsoft.AspNetCore.HttpSys.Internal.RequestUriBuilder.DecodeAndUnescapePath(Span`1 rawUrlBytes)
at Microsoft.AspNetCore.Server.IIS.Core.IISHttpContext.GetOriginalPath()
at Microsoft.AspNetCore.Server.IIS.Core.IISHttpContext.InitializeContext()
at Microsoft.AspNetCore.Server.IIS.Core.IISHttpContextOfT`1.ProcessRequestAsync()
at Microsoft.AspNetCore.Server.IIS.Core.IISHttpContext.HandleRequest()
出现这个问题时没有使用 IIS InProcess Hosting 方式部署
路径中出现了中文路径?
不知道是哪个请求路径引起这个问题的?
特殊字符不一定是中文,还有不可见字符,这个可以用正则遍历判断下。
请教下,最终是如何解决的呢?
不好意思,忘记了