Closed xuSs1994 closed 7 years ago
就这一个方法报错吗?
整个流程这是第一步,调用时报错,下面的也没法继续
经过测试这个问题只会在.net core下才会出现
根据发上来的错误堆栈,我去看了下 HttpContent 源码 https://github.com/dotnet/corefx/blob/dev/release/2.0.0/src/System.Net.Http/src/System/Net/Http/HttpContent.cs#L205 如果微信那边返回的 CharSet 真的是 utf8 的话,的确会报你说的错误,因为 Encoding.GetEncoding 承认的参数是 UTF-8 而不是 uft8,这个在以前的 issus 中已经提交过修复的,但现在这段出错代码是 netcore runtime 里面的,参数也是微信那边返回过来的,这个就不好处理了。。。 我晚点提交个临时解决办法再测试下吧
已经发布到Nuget的一个隐藏版本,各位可以试一下:https://www.nuget.org/packages/Senparc.Weixin/4.16.5
我这边抓到的包是 utf-8 的,是正确的,所以没法测试。。。@xuSs1994 你可以把 Senparc.Weixin 升级到 4.16.5 试试
@xuSs1994 欢迎反馈结果,如果可以的话我们就发布到正式版本啦
( 此版块专为反馈bug及提交需求服务,不负责解答开发问题,请勿发表开发问题, 如果您需要这方面的帮助,请移步
问答社区
:https://weixin.senparc.com/QA )问题描述
ShakeAroundApi.GroupAdd();这个方法运行会报错
微信官方文档 URL
微信官方文档快照(直接复制关键内容到下方)
Unhandled Exception: System.InvalidOperationException: The character set provided in ContentType is invalid. Cannot read content as string using an invalid character set. ---> System.ArgumentException: 'utf8' is not a supported encoding name. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method. Parameter name: name at System.Globalization.EncodingTable.internalGetCodePageFromName(String name) at System.Globalization.EncodingTable.GetCodePageFromName(String name) at System.Text.Encoding.GetEncoding(String name) at System.Net.Http.HttpContent.ReadBufferAsString(ArraySegmentb36_0(HttpContent s)
at System.Net.Http.HttpContent.d62b 0(String accessToken)
at Senparc.Weixin.CommonAPIs.ApiHandlerWapper.ApiHandlerWapperBase.TryCommonApiBase[T](PlatformType platformType, Func
1 buffer, HttpContentHeaders headers) --- End of inner exception stack trace --- at System.Net.Http.HttpContent.ReadBufferAsString(ArraySegment
1 buffer, HttpContentHeaders headers) at System.Net.Http.HttpContent.ReadBufferedContentAsString() at System.Net.Http.HttpContent.<>c.2.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Senparc.Weixin.HttpUtility.RequestUtility.HttpPost(String url, CookieContainer cookieContainer, Stream postStream, Dictionary
2 fileDictionary, String refererUrl, Encoding encoding, X509Certificate2 cer, Int32 timeOut, Boolean checkValidationResult) at Senparc.Weixin.HttpUtility.Post.PostGetJson[T](String url, CookieContainer cookieContainer, Stream fileStream, Encoding encoding, X509Certificate2 cer, Int32 timeOut, Boolean checkValidationResult) at Senparc.Weixin.CommonAPIs.CommonJsonSend.Send[T](String accessToken, String urlFormat, Object data, CommonJsonSendType sendType, Int32 timeOut, Boolean checkValidationResult, JsonSetting jsonSetting) at Senparc.Weixin.MP.AdvancedAPIs.ShakeAroundApi.<>cDisplayClass26_0.1 accessTokenContainer_GetFirstOrDefaultAppIdFunc, Func
2 accessTokenContainer_CheckRegisteredFunc, Func3 accessTokenContainer_GetAccessTokenResultFunc, Int32 invalidCredentialValue, Func
2 fun, String accessTokenOrAppId, Boolean retryIfFaild) at Senparc.Weixin.MP.ApiHandlerWapper.TryCommonApi[T](Func`2 fun, String accessTokenOrAppId, Boolean retryIfFaild) at IBeaconManage.Program.Main(String[] args) in D:\Project\IBeaconManage\IBeaconManage\Program.cs:line 24发现问题的模块
模块对应的.net版本
开发环境
缓存环境