我正在使用docker在Mac上运行sql服务器,它正在与.net核心应用程序通信。我正在运行连接到指定数据库的specflow测试,创建所需的架构,然后运行测试。在Mac上运行这些测试时,出现以下异常,但在Windows计算机上可以正常工作。 .net核心中缺少任何库?
我的连接字符串如下所示:public static string ConnectionString = @“ Server = localhost:1433; Database = csn_product; User = sa; Password = ****;”;
MultipleActiveResultSets = true; Trusted_Connection=False; Integrated_Security=False
我也在连接字符串中尝试了上述参数,但没有任何效果。
Microsoft.SqlServer.Management.Common.ConnectionFailureException: Failed to connect to server MyServer. ---> System.Data.SqlClient.SqlException: Unable to find an entry point named 'NetSecurityNative_ImportPrincipalName' in shared library 'System.Net.Security.Native'.
at Interop.NetSecurityNative.ImportPrincipalName(Status& minorStatus, String inputName, Int32 inputNameByteCount, SafeGssNameHandle& outputName)
at Microsoft.Win32.SafeHandles.SafeGssNameHandle.CreatePrincipal(String name)
at System.Net.Security.SafeDeleteNegoContext..ctor(SafeFreeNegoCredentials credential, String targetName)
at System.Net.Security.NegotiateStreamPal.EstablishSecurityContext(SafeFreeNegoCredentials credential, SafeDeleteContext& context, String targetName, ContextFlagsPal inFlags, SecurityBuffer inputBuffer, SecurityBuffer outputBuffer, ContextFlagsPal& outFlags)
at System.Net.Security.NegotiateStreamPal.InitializeSecurityContext(SafeFreeCredentials credentialsHandle, SafeDeleteContext& securityContext, String spn, ContextFlagsPal requestedContextFlags, SecurityBuffer[] inSecurityBufferArray, SecurityBuffer outSecurityBuffer, ContextFlagsPal& contextFlags)
at System.Data.SqlClient.SNI.SNIProxy.GenSspiClientContext(SspiClientContextStatus sspiClientContextStatus, Byte[] receivedBuff, Byte[]& sendBuff, Byte[] serverName)
at System.Data.SqlClient.SNI.TdsParserStateObjectManaged.GenerateSspiClientContext(Byte[] receivedBuff, UInt32 receivedLength, Byte[]& sendBuff, UInt32& sendLength, Byte[] _sniSpnBuffer)
at System.Data.SqlClient.TdsParser.SNISSPIData(Byte[] receivedBuff, UInt32 receivedLength, Byte[]& sendBuff, UInt32& sendLength)
at at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection)
at at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection)
at at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
at at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
at at System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
at at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)
at at System.Data.SqlClient.SqlConnection.Open()
at at Microsoft.SqlServer.Management.Common.ConnectionManager.InternalConnect()
at at Microsoft.SqlServer.Management.Common.ConnectionManager.Connect()