我希望这个问题不是太模糊,但我看得很远但却找不到任何有用的错误.
我有一个.NET 4.5.2 Web服务层(使用ServiceStack和Dapper),自从我们部署服务以来,它几乎没有收到这两个错误.
第一个错误:
2017-09-29 18:13:26.637 +00:00 [Error] Class: "TokenRepository" | Method: "GetToken" System.Security.Authentication.AuthenticationException: A call to SSPI Failed,see inner exception. ---> System.ComponentModel.Win32Exception: The message received was unexpected or badly formatted --- End of inner exception stack trace --- at System.Net.Security.SslState.StartSendAuthResetSignal(ProtocolToken message,AsyncProtocolRequest asyncRequest,Exception exception) at System.Net.Security.SslState.ProcessReceivedBlob(Byte[] buffer,Int32 count,AsyncProtocolRequest asyncRequest) at System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer,AsyncProtocolRequest asyncRequest) at System.Net.Security.SslState.ProcessReceivedBlob(Byte[] buffer,AsyncProtocolRequest asyncRequest) at System.Net.Security.SslState.ForceAuthentication(Boolean receiveFirst,Byte[] buffer,AsyncProtocolRequest asyncRequest) at System.Net.Security.SslState.ProcessAuthentication(LazyAsyncResult lazyResult) at @R_301_198@.Data.@R_301_198@Client.NativeDriver.StartSSL() at @R_301_198@.Data.@R_301_198@Client.NativeDriver.Open() at @R_301_198@.Data.@R_301_198@Client.Driver.Open() at @R_301_198@.Data.@R_301_198@Client.Driver.Create(@R_301_198@ConnectionStringBuilder settings) at @R_301_198@.Data.@R_301_198@Client.@R_301_198@Pool.CreateNewPooledConnection() at @R_301_198@.Data.@R_301_198@Client.@R_301_198@Pool.GetPooledConnection() at @R_301_198@.Data.@R_301_198@Client.@R_301_198@Pool.TryToGetDriver() at @R_301_198@.Data.@R_301_198@Client.@R_301_198@Pool.GetConnection() at @R_301_198@.Data.@R_301_198@Client.@R_301_198@Connection.Open() at Dapper.sqlMapper.<QueryImpl>d__125`1.MoveNext() at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) at Dapper.sqlMapper.Query[T](IDbConnection cnn,String sql,Object param,IDbTransaction transaction,Boolean buffered,Nullable`1 commandTimeout,Nullable`1 commandType) at myApp.Services.Data.Impl.TokenRepository.GetToken(String token) in E:\Jenkins\workspace\myApp\src\Services.Data\Impl\TokenRepository.cs:line 191
第二个……
2017-09-19 15:40:51.040 +00:00 [Error] Class: "myApp.Services.Data.Impl.SystemRepository" | Method: "GetAttributes" System.Security.Authentication.AuthenticationException: A call to SSPI Failed,see inner exception. ---> System.ComponentModel.Win32Exception: The buffers supplied to a function was too small --- End of inner exception stack trace --- at System.Net.Security.SslState.StartSendAuthResetSignal(ProtocolToken message,Nullable`1 commandType) at myApp.Services.Data.Impl.SystemRepository.GetAttributes() in E:\Jenkins\workspace\myApp\src\Services.Data\Impl\SystemRepository.cs:line 38
我的堆栈上有一点背景:
> .NET 4.5.2
> Dapper 1.50.2.0
> ServiceStack 4.5.4
> @R_301_198@ 5.6(使用Amazon Aurora)
我们在任何其他环境中都没有收到此错误,我们没有运行Aurora,只是在Amazon RDS上运行@R_301_198@ 5.7.17.
正如我所提到的,这些错误是偶发的,并不总是发生在相同的方法/服务上,但它们总是在使用Dapper从服务层到@R_301_198@数据库执行sql命令时发生.
有没有进一步调试这个或者是否有任何与@R_301_198@ / Aurora / Dapper相关的已知问题?经过研究,我找不到任何东西.
解决方法
看看这个
https://github.com/mysql-net/MySqlConnector/issues/428
我遇到了类似技术堆栈的同样错误.一个简单的解决方法是在connectionString中添加SslMode = None,它应该可以工作.