首页 新闻 赞助 找找看

Windows 上跑 .NET Core 3.0 遇到 "Unable to translate bytes code" 问题

0
悬赏园豆:30 [待解决问题]

在 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 方式部署

dudu的主页 dudu | 高人七级 | 园豆:31075
提问于:2019-08-15 07:57
< >
分享
所有回答(3)
0

谷歌找了下 好像是编码问题
https://github.com/aspnet/AspNetCore/issues/8676
似乎有规避的办法

winds_随风 | 园豆:156 (初学一级) | 2019-08-15 09:20
0

路径中出现了中文路径?

大志若愚 | 园豆:2138 (老鸟四级) | 2019-08-15 10:40

不知道是哪个请求路径引起这个问题的?

支持(0) 反对(0) dudu | 园豆:31075 (高人七级) | 2019-08-15 17:49

特殊字符不一定是中文,还有不可见字符,这个可以用正则遍历判断下。

支持(0) 反对(0) 张朋举 | 园豆:1915 (小虾三级) | 2019-09-09 12:37
0

请教下,最终是如何解决的呢?

yinnnleiii | 园豆:19 (初学一级) | 2022-06-20 11:36

不好意思,忘记了

支持(0) 反对(0) dudu | 园豆:31075 (高人七级) | 2022-06-20 11:45
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册