I have an WPF app, which uses SSLStream to connect to server and send/receive some messages. My code is largerly based on this example (SslTcpClient): https://msdn.microsoft.com/en-us/library/system.net.security.sslstream(v=vs.110).aspx.
This worked fine for months. However, after getting this windows update (Cumulative Update for Windows 10 version 1511 and Windows Server 2016 Technical Preview 4: June 14, 2016 — https://support.microsoft.com/en-us/kb/3163018). My app started to report this exception:
System.Security.Authentication.AuthenticationException: A call to SSPI failed, see inner exception. ---> System.ComponentModel.Win32Exception: The Local Security Authority cannot be contacted
--- End of inner exception stack trace ---
at System.Net.Security.SslState.StartSendAuthResetSignal(ProtocolToken message, AsyncProtocolRequest asyncRequest, Exception exception)
at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ProcessReceivedBlob(Byte[] buffer, Int32 count, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartReadFrame(Byte[] buffer, Int32 readBytes, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ForceAuthentication(Boolean receiveFirst, Byte[] buffer, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ProcessAuthentication(LazyAsyncResult lazyResult)
at System.Net.Security.SslStream.AuthenticateAsClient(String targetHost, X509CertificateCollection clientCertificates, SslProtocols enabledSslProtocols, Boolean checkCertificateRevocation)
at MyAPP.Core.Services.Network.Impl.SslTcpClient.ClientSideHandshake()
at MyAPP.Core.Services.Network.Impl.SslTcpClient.Connect()
at MyAPP.Core.Services.Impl.MessageService.SendMessage(String message)
What can I do ?
У меня есть следующий код:
public GetUserDataResponse GetUserDataFromService(X509Certificate2 certificate)
{
ChannelFactory<MyApp4SITHSService.IMyApp4SITHSServiceContract> factory = new ChannelFactory<MyApp4SITHSService.IMyApp4SITHSServiceContract>("NetTcpBinding_IMyApp4SITHSServiceContract_Certificate");
MyApp4SITHSService.IMyApp4SITHSServiceContract service;
GetUserDataResponse response;
factory.Credentials.ClientCertificate.Certificate = certificate;
//factory.Credentials.UserName.UserName = "me";
//factory.Credentials.UserName.Password = "password";
service = factory.CreateChannel();
LogHandler.WriteLine("Connecting to service");
response = service.GetUserData(new GetUserDataRequest());
LogHandler.WriteLine("Data received");
factory.Abort();
return response;
}
В первый раз, когда я запускаю это, он работает отлично, во второй раз я получаю следующее исключение на service.GetUserData:
Произошла первая случайная ошибка типа «System.ServiceModel.Security.SecurityNegotiationException» в mscorlib.dll
Не удалось выполнить вызов SSPI, см. внутреннее исключение.
Локальный центр безопасности не может связаться
Im, используя следующие конфигурации:
<system.serviceModel>
<behaviors>
<endpointBehaviors>
<behavior name="CertificateEndpointBehavior">
<clientCredentials>
<!--<clientCertificate findValue="MyAppClient" x509FindType="FindBySubjectName" storeLocation="CurrentUser" storeName="TrustedPeople"/>-->
<!--<clientCertificate findValue="MyAppClient" x509FindType="FindBySubjectName" storeLocation="LocalMachine" storeName="My"/>-->
<serviceCertificate>
<authentication certificateValidationMode="ChainTrust" revocationMode="NoCheck"/>
</serviceCertificate>
</clientCredentials>
</behavior>
</endpointBehaviors>
</behaviors>
<bindings>
<netTcpBinding>
<binding name="netTcpCertificate" closeTimeout="00:01:00" openTimeout="00:01:00"
receiveTimeout="Infinite" sendTimeout="01:00:00" transactionFlow="false"
transferMode="Buffered" transactionProtocol="OleTransactions"
hostNameComparisonMode="StrongWildcard" listenBacklog="1000"
maxBufferPoolSize="2147483647" maxBufferSize="2147483647"
maxConnections="200" maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<reliableSession ordered="true" inactivityTimeout="Infinite"
enabled="false" />
<security mode="Transport">
<transport clientCredentialType="Certificate" />
<message clientCredentialType="Certificate" />
</security>
</binding>
</netTcpBinding>
</bindings>
<client>
<endpoint address="net.tcp://localhost:8135/MyApp4SITHSService/Client/sll"
behaviorConfiguration="CertificateEndpointBehavior" binding="netTcpBinding"
bindingConfiguration="netTcpCertificate" contract="MyApp4SITHSService.IMyApp4SITHSServiceContract"
name="NetTcpBinding_IMyApp4SITHSServiceContract_Certificate">
<identity>
<dns value="MyAppServer" />
</identity>
</endpoint>
</client>
</system.serviceModel>
Любая идея, почему я получаю эту проблему и как ее решить?
I have the following solution :
WCF service hosted in Windows Service
WCF configurated to use TCP
After i updated Windows Server, i receive this error from my code:
System.Security.Authentication.AuthenticationException
A call to SSPI failed, see inner exception.
at System.Net.Security.SslState.StartSendAuthResetSignal(ProtocolToken message, AsyncProtocolRequest asyncRequest, Exception exception)
at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
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.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
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.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
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.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
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.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ForceAuthentication(Boolean receiveFirst, Byte[] buffer, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ProcessAuthentication(LazyAsyncResult lazyResult)
at System.Net.Security.SslStream.AuthenticateAsClient(String targetHost)
at Counterpoint.Irina.Services.ServerConnector.ConnectorBaseSsl..ctor(String ipServer, Int32 port) in
---------- Inner Exception ----------
System.ComponentModel.Win32Exception
One or more of the parameters passed to the function was invalid
My programs is in C# and i use a TcpClient with SslStream in this way :
_connection = new TcpClient(ipServer, port);
sslStream = new SslStream(_connection.GetStream(), false, new RemoteCertificateValidationCallback(CertificateReceived));
sslStream.AuthenticateAsClient(ipServer);
And this is the code of RemoteCertificate
// The following method is invoked by the RemoteCertificateValidationDelegate.
// This allows you to check the certificate and accept or reject it
// return true will accept the certificate
private static bool CertificateReceived(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
{
return true;
}
Update:
The error on eventviewver is
«The following fatal alert was generated: 40. The internal error state is 808.»
Update 2
The problem is the update KG3172605
https://support.microsoft.com/it-it/kb/3172605
Please help 🙂
I have the following solution :
WCF service hosted in Windows Service
WCF configurated to use TCP
After i updated Windows Server, i receive this error from my code:
System.Security.Authentication.AuthenticationException
A call to SSPI failed, see inner exception.
at System.Net.Security.SslState.StartSendAuthResetSignal(ProtocolToken message, AsyncProtocolRequest asyncRequest, Exception exception)
at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
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.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
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.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
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.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
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.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ForceAuthentication(Boolean receiveFirst, Byte[] buffer, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ProcessAuthentication(LazyAsyncResult lazyResult)
at System.Net.Security.SslStream.AuthenticateAsClient(String targetHost)
at Counterpoint.Irina.Services.ServerConnector.ConnectorBaseSsl..ctor(String ipServer, Int32 port) in
---------- Inner Exception ----------
System.ComponentModel.Win32Exception
One or more of the parameters passed to the function was invalid
My programs is in C# and i use a TcpClient with SslStream in this way :
_connection = new TcpClient(ipServer, port);
sslStream = new SslStream(_connection.GetStream(), false, new RemoteCertificateValidationCallback(CertificateReceived));
sslStream.AuthenticateAsClient(ipServer);
And this is the code of RemoteCertificate
// The following method is invoked by the RemoteCertificateValidationDelegate.
// This allows you to check the certificate and accept or reject it
// return true will accept the certificate
private static bool CertificateReceived(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
{
return true;
}
Update:
The error on eventviewver is
«The following fatal alert was generated: 40. The internal error state is 808.»
Update 2
The problem is the update KG3172605
https://support.microsoft.com/it-it/kb/3172605
Please help 🙂
This is a portion of the exception json log.
The strange thing is i am not using ssl.
"_index": "log-2018.01.24",
"_type": "logEvent",
"_id": "AWEp3wn8NcVp4M8On1s1",
"_version": 1,
"_score": null,
"_source": {
"timeStamp": "2018-01-24T20:32:18.2730385Z",
"message": "Application error",
"messageObject": {},
"exception": {
"Type": "MySql.Data.MySqlClient.MySqlException",
"Message": "SSL Authentication Error",
"HelpLink": null,
"Source": "MySqlConnector",
"HResult": -2147467259,
"StackTrace": " at MySql.Data.Serialization.MySqlSession.d__67.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 System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.GetResult()
at MySql.Data.Serialization.MySqlSession.d__52.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 MySql.Data.MySqlClient.MySqlConnection.d__79.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 MySql.Data.MySqlClient.MySqlConnection.d__19.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 System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
at MySql.Data.MySqlClient.MySqlConnection.Open()
at Microsoft.EntityFrameworkCore.Storage.Internal.MySqlConnectionSettings.<>c__DisplayClass2_0.b__0(String key)
at System.Collections.Concurrent.ConcurrentDictionary2.GetOrAdd(TKey key, Func2 valueFactory)
at System.Lazy1.CreateValue()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Lazy1.get_Value()
at Microsoft.EntityFrameworkCore.Storage.Internal.MySqlSmartTypeMapper.MaybeConvertMapping(RelationalTypeMapping mapping)
at Microsoft.EntityFrameworkCore.Storage.RelationalTypeMapper.IsTypeMapped(Type clrType)
at System.Linq.Enumerable.WhereArrayIterator1.MoveNext()
at Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal.PropertyDiscoveryConvention.Apply(InternalEntityTypeBuilder entityTypeBuilder)
at Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal.ConventionDispatcher.ImmediateConventionScope.OnEntityTypeAdded(InternalEntityTypeBuilder entityTypeBuilder)
at Microsoft.EntityFrameworkCore.Metadata.Internal.Model.AddEntityType(EntityType entityType)
at Microsoft.EntityFrameworkCore.Metadata.Internal.InternalModelBuilder.Entity(TypeIdentity type, ConfigurationSource configurationSource)
at Microsoft.EntityFrameworkCore.Metadata.Internal.InternalModelBuilder.Entity(Type type, ConfigurationSource configurationSource)
at Microsoft.EntityFrameworkCore.ModelBuilder.Entity(Type type)
at Microsoft.EntityFrameworkCore.Infrastructure.ModelCustomizer.FindSets(ModelBuilder modelBuilder, DbContext context)
at Microsoft.EntityFrameworkCore.Infrastructure.RelationalModelCustomizer.FindSets(ModelBuilder modelBuilder, DbContext context)
at Microsoft.EntityFrameworkCore.Infrastructure.ModelCustomizer.Customize(ModelBuilder modelBuilder, DbContext context)
at Microsoft.EntityFrameworkCore.Infrastructure.ModelSource.CreateModel(DbContext context, IConventionSetBuilder conventionSetBuilder, IModelValidator validator)
at System.Collections.Concurrent.ConcurrentDictionary2.GetOrAdd(TKey key, Func2 valueFactory)
at Microsoft.EntityFrameworkCore.Internal.DbContextServices.CreateModel()
at Microsoft.EntityFrameworkCore.Internal.DbContextServices.get_Model()
at lambda_method(Closure , ServiceProvider )
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider)
at Microsoft.EntityFrameworkCore.DbContext.get_DbContextDependencies()
at Microsoft.EntityFrameworkCore.DbContext.get_InternalServiceProvider()
at Microsoft.EntityFrameworkCore.DbContext.get_DbContextDependencies()
at Microsoft.EntityFrameworkCore.DbContext.get_Model()
at Microsoft.EntityFrameworkCore.Internal.InternalDbSet1.get_EntityType()
at Microsoft.EntityFrameworkCore.Internal.InternalDbSet1.get_EntityQueryable()
at Microsoft.EntityFrameworkCore.Internal.InternalDbSet1.System.Linq.IQueryable.get_Provider()
at System.Linq.Queryable.Any[TSource](IQueryable1 source, Expression1 predicate)
at Chatbooks.Core.Vocabluary.Using[T,TResult](Func1 init, Func2 func)
at folkstory.Global.Application_PreRequestHandlerExecute(Object send, EventArgs e) in C:TeamCitybuildAgentwork53f103504e450429trunkfolkstoryWebsiteGlobal.asax.cs:line 140
at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)",
"Data": {},
"InnerException": {
"Type": "System.Security.Authentication.AuthenticationException",
"Message": "A call to SSPI failed, see inner exception.",
"HelpLink": null,
"Source": "System",
"HResult": -2146233087,
"StackTrace": " at System.Net.Security.SslState.StartSendAuthResetSignal(ProtocolToken message, AsyncProtocolRequest asyncRequest, Exception exception)
at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)
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.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)
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.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)
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.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)
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.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)
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.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ForceAuthentication(Boolean receiveFirst, Byte[] buffer, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ProcessAuthentication(LazyAsyncResult lazyResult)
at MySql.Data.Serialization.MySqlSession.d__67.MoveNext()",
"Data": {},
"InnerException": {
"Type": "System.ComponentModel.Win32Exception",
"Message": "The message received was unexpected or badly formatted",
"HelpLink": null,
"Source": null,
"HResult": -2147467259,
"StackTrace": null,
"Data": {},
"InnerException": null
}
}
},
У меня странная проблема: я написал сервер и клиент на С# на основе .net2, которые общаются через .net 2 SslStream. Существует 1 соединение для отправки команд между Cl и S и одно соединение для отправки файлов между cl и s.
Локально все работает нормально на моей машине с Windows. Но если я запускаю сервер на своем сервере Linux (с моно), обмен файлами не работает в определенных ситуациях. У меня разные Категории для файлов, и в 2-х из 3-х работает, в третьих сервер виснет на SSLStream.AuthenticateAsServer(....); и клиент выдает исключение с сообщением «Ошибка вызова SSPI, см. внутреннее исключение». Внутреннее исключение — это исключение System.ComponentModel.Win32Exception с сообщением «Полученное сообщение было неожиданным или неправильно отформатировано».
Я думаю, что мой способ запустить его в Linux может быть неправильным. На самом деле я использую VS2012 для локальной разработки, и когда я хочу поместить его на сервер, я загружаю скомпилированный exe-файл с помощью VS, и я использую mono server.exe чтобы начать это. Но я также пытался использовать monodevelop в Windows для его компиляции (скомпилированные материалы из monodevelop также работают локально) и использовать его на сервере Linux, но это закончилось тем же результатом.
Любая помощь будет оценена.
Вот мой сокращенный код:
Клиент:
//gets auth guid before, then it does
Thread Thre = new Thread(sendfile);
Thre.Start(authguid);
private void sendfile(string guid){
TcpClient cl = new TcpClient();
cl.Connect(hostname, 8789);
SslStream Stream = new SslStream(cl.GetStream(), true, new RemoteCertificateValidationCallback(ServerConnector.ValidateServerCertificate));
Stream.AuthenticateAsClient(hostname);//throws the exception
//sends auth guid and file
}
Сервер:
public class FServer
{
protected static bool halt = false;
protected List<FConnection> connections;
private TcpListener tcpServer;
private IPEndPoint ipEnde = new IPEndPoint(IPAddress.Any, 8789);
private delegate void dlgAccept();
private dlgAccept accepting;
private IAsyncResult resAccept;
public FServer()
{
tcpServer = new TcpListener(ipEnde);
connections = new List<FConnection>();
tcpServer.Start();
accepting = new dlgAccept(accept);
resAccept = accepting.BeginInvoke(null, null);
}
public void accept()
{
do
{
if (tcpServer.Pending())
connections.Add(new FConnection(tcpServer.AcceptTcpClient(), this));
else
Thread.Sleep(750);
} while (!halt && tcpServer != null);
}
public class FConnection
{
public SslStream stream;
//.....some other properties
public static bool ValidateClientCertificate (object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
{
return true;
}
public FConnection(TcpClient cl, FServer inst)
{
instance = inst;
client = cl;
stream = new SslStream(client.GetStream(), false, new RemoteCertificateValidationCallback(ValidateClientCertificate), null);
stream.AuthenticateAsServer(instance.mainserver.serverCert, false, SslProtocols.Tls, false);//hangs sometimes on this
if (stream.IsAuthenticated && stream.IsEncrypted)
{
}
else
{
this.Dispose();
}
//auth and receiving file
}
}
}
Microsoft.Mashup.Container.NetFX40.exe Error: 0 : A call to SSPI failed, see inner exception.
DataMashup.Trace Error: 24579 : {«Start»:»2016-09-28T14:12:45.9387300Z»,»Action»:»Engine/IO/Db/MySql/ProcessException»,»Exception»:»Exception:rnExceptionType: System.Security.Authentication.AuthenticationException, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089rnMessage: A call to SSPI failed, see inner exception.rnStackTrace:n at System.Net.Security.SslState.StartSendAuthResetSignal(ProtocolToken message, AsyncProtocolRequest asyncRequest, Exception exception)rn at System.Net.Security.SslState.ProcessReceivedBlob(Byte[] buffer, Int32 count, AsyncProtocolRequest asyncRequest)rn at System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest)rn at System.Net.Security.SslState.ProcessReceivedBlob(Byte[] buffer, Int32 count, AsyncProtocolRequest asyncRequest)rn at System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest)rn at System.Net.Security.SslState.ProcessReceivedBlob(Byte[] buffer, Int32 count, AsyncProtocolRequest asyncRequest)rn at System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest)rn at System.Net.Security.SslState.ProcessReceivedBlob(Byte[] buffer, Int32 count, AsyncProtocolRequest asyncRequest)rn at System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest)rn at System.Net.Security.SslState.ProcessReceivedBlob(Byte[] buffer, Int32 count, AsyncProtocolRequest asyncRequest)rn at System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest)rn at System.Net.Security.SslState.ForceAuthentication(Boolean receiveFirst, Byte[] buffer, AsyncProtocolRequest asyncRequest)rn at System.Net.Security.SslState.ProcessAuthentication(LazyAsyncResult lazyResult)rn at MySql.Data.MySqlClient.NativeDriver.StartSSL()rn at MySql.Data.MySqlClient.NativeDriver.Open()rn at MySql.Data.MySqlClient.Driver.Open()rn at MySql.Data.MySqlClient.Driver.Create(MySqlConnectionStringBuilder settings)rn at MySql.Data.MySqlClient.MySqlPool.CreateNewPooledConnection()rn at MySql.Data.MySqlClient.MySqlPool.GetPooledConnection()rn at MySql.Data.MySqlClient.MySqlPool.TryToGetDriver()rn at MySql.Data.MySqlClient.MySqlPool.GetConnection()rn at MySql.Data.MySqlClient.MySqlConnection.Open()rn at Microsoft.Mashup.Engine1.Library.Common.WrappedDbConnection.Open()rn at Microsoft.Mashup.Engine1.Library.Common.DbExtensions.<>c__DisplayClass1.<Open>b__0()rn at Microsoft.Mashup.Engine1.Library.Common.DbEnvironment.RunWithRetryGuard[T](Func`1 action, Func`2 retryAfterSqlError, Action finalizeOnRetry, String dataSourceNameString, IEngineHost host)rn at Microsoft.Mashup.Engine1.Library.Common.DbEnvironment.ConvertDbExceptions[T](IResource resource, Func`1 action, Func`2 retryAfterSqlError, Action finalizeOnRetry, String dataSourceNameString, IEngineHost host)rnrnInnerExceptionrnException:rnExceptionType: System.ComponentModel.Win32Exception, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089rnMessage: The Local Security Authority cannot be contactedrnStackTrace:nrnrnrnrnrn»,»ProductVersion»:»2.38.4491.282 (PBIDesktop)»,»ActivityId»:»f244fe92-ca84-4c4c-b0f4-892802227819″,»Process»:»Microsoft.Mashup.Container.NetFX40″,»Pid»:80,»Tid»:1,»Duration»:»00:00:00.0001144«}
DataMashup.Trace Information: 24579 : {«Start»:»2016-09-28T14:12:45.6148071Z»,»Action»:»Engine/IO/Db/MySQL/RunWithRetry»,»ProductVersion»:»2.38.4491.282 (PBIDesktop)»,»ActivityId»:»f244fe92-ca84-4c4c-b0f4-892802227819″,»Process»:»Microsoft.Mashup.Container.NetFX40″,»Pid»:80,»Tid»:1,»Duration»:»00:00:00.3240824«}
DataMashup.Trace Information: 24579 : {«Start»:»2016-09-28T14:12:45.6147468Z»,»Action»:»Engine/IO/Db/MySQL/RunWithRetry»,»ProductVersion»:»2.38.4491.282 (PBIDesktop)»,»ActivityId»:»f244fe92-ca84-4c4c-b0f4-892802227819″,»Process»:»Microsoft.Mashup.Container.NetFX40″,»Pid»:80,»Tid»:1,»Duration»:»00:00:00.3241940«}
Добрый день. В логах вдруг появились ошибки
Сбой управляющего агента "MOSSAD-Sync AD" на профиле выполнения "DS_FULLIMPORT" из-за проблем подключения. Дополнительные сведения Ошибки обнаружения : "0" Ошибки синхронизации : "0" Ошибки повтора метавселенной : "0" Ошибки экспорта : "0" Предупреждения : "0" Действие пользователя Для получения подробных сведений см. журнал выполнения управляющего агента. Event ID 6050 Источник FIMSynchronizationService
Не удалось выполнить задание администрирования сервера приложений для экземпляра службы Microsoft.Office.Server.Search.Administration.SearchServiceInstance (338024ec-41e0-403f-abbc-24ee197d3c6d). Причина: Ошибка вызова SSPI, см. внутреннее исключение. Сведения для службы технической поддержки: System.ServiceModel.Security.SecurityNegotiationException: Ошибка вызова SSPI, см. внутреннее исключение. ---> System.Security.Authentication.AuthenticationException: Ошибка вызова SSPI, см. внутреннее исключение. ---> System.ComponentModel.Win32Exception: Главное конечное имя неверно --- Конец трассировки внутреннего стека исключений --- в System.Net.Security.NegoState.StartSendAuthResetSignal(LazyAsyncResult lazyResult, Byte[] message, Exception exception) в System.Net.Security.NegoState.StartSendBlob(Byte[] message, LazyAsyncResult lazyResult) в System.Net.Security.NegoState.CheckCompletionBeforeNextSend(Byte[] message, LazyAsyncResult lazyResult) в System.Net.Security.NegoState.ProcessReceivedBlob(Byte[] message, LazyAsyncResult lazyResult) в System.Net.Security.NegoState.StartSendBlob(Byte[] message, LazyAsyncResult lazyResult) в System.Net.Security.NegoState.ProcessAuthentication(LazyAsyncResult lazyResult) в System.Net.Security.NegotiateStream.AuthenticateAsClient(NetworkCredential credential, String targetName, ProtectionLevel requiredProtectionLevel, TokenImpersonationLevel allowedImpersonationLevel) в System.ServiceModel.Channels.WindowsStreamSecurityUpgradeProvider.WindowsStreamSecurityUpgradeInitiator.OnInitiateUpgrade(Stream stream, SecurityMessageProperty& remoteSecurity) --- Конец трассировки внутреннего стека исключений --- Server stack trace: в System.ServiceModel.Channels.WindowsStreamSecurityUpgradeProvider.WindowsStreamSecurityUpgradeInitiator.OnInitiateUpgrade(Stream stream, SecurityMessageProperty& remoteSecurity) в System.ServiceModel.Channels.StreamSecurityUpgradeInitiatorBase.InitiateUpgrade(Stream stream) в System.ServiceModel.Channels.ConnectionUpgradeHelper.InitiateUpgrade(StreamUpgradeInitiator upgradeInitiator, IConnection& connection, ClientFramingDecoder decoder, IDefaultCommunicationTimeouts defaultTimeouts, TimeoutHelper& timeoutHelper) в System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.SendPreamble(IConnection connection, ArraySegment`1 preamble, TimeoutHelper& timeoutHelper) в System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.DuplexConnectionPoolHelper.AcceptPooledConnection(IConnection connection, TimeoutHelper& timeoutHelper) в System.ServiceModel.Channels.ConnectionPoolHelper.EstablishConnection(TimeSpan timeout) в System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.OnOpen(TimeSpan timeout) в System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) в System.ServiceModel.Channels.ServiceChannel.OnOpen(TimeSpan timeout) в System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) в System.ServiceModel.Channels.ServiceChannel.CallOnceManager.CallOnce(TimeSpan timeout, CallOnceManager cascade) в System.ServiceModel.Channels.ServiceChannel.EnsureOpened(TimeSpan timeout) в System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout) в System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation) в System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message) Exception rethrown at [0]: в Microsoft.Office.Server.Search.Administration.SearchServiceInstance.Synchronize() в Microsoft.Office.Server.Administration.ApplicationServerJob.ProvisionLocalSharedServiceInstances(Boolean isAdministrationServiceJob) Event ID 6482
Произошла ошибка определения компонента "{1C12B6E6-898C-4D58-9774-AAAFBDFE273C}", свойства "PeopleILM", продукта "{90150000-104C-0000-1000-0000000FF1CE}". Ресурс "C:Program FilesMicrosoft Office Servers15.0ServiceMicrosoft.ResourceManagement.Service.exe" не существует.
Произошла ошибка определения свойства "PeopleILM" продукта "{90150000-104C-0000-1000-0000000FF1CE}" при запросе компонента "{9AE4D8E0-D3F6-47A8-8FAE-38496FE32FF5}"
EventID 1001, 1004
Источник MsiInstaller
Гугление мне ничего не дало по этим ошибкам толкового.
-
Изменено
23 июня 2015 г. 10:00
У меня есть приложение WPF, которое использует SSLStream для подключения к серверу и отправки / получения некоторых сообщений. Мой код в большей степени основан на этом примере (SslTcpClient): https://msdn.microsoft.com/en-us/library/system.net.security.sslstream (v = vs.110) .aspx.
Это работало нормально в течение нескольких месяцев. Однако после получения этого обновления Windows (накопительное обновление для Windows 10 версии 1511 и Windows Server 2016 Technical Preview 4: 14 июня 2016 г. — https://support.microsoft.com/en-us/kb/3163018). Мое приложение начало сообщать об этом исключении:
System.Security.Authentication.AuthenticationException: A call to SSPI failed, see inner exception. ---> System.ComponentModel.Win32Exception: The Local Security Authority cannot be contacted
--- End of inner exception stack trace ---
at System.Net.Security.SslState.StartSendAuthResetSignal(ProtocolToken message, AsyncProtocolRequest asyncRequest, Exception exception)
at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ProcessReceivedBlob(Byte[] buffer, Int32 count, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartReadFrame(Byte[] buffer, Int32 readBytes, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ForceAuthentication(Boolean receiveFirst, Byte[] buffer, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ProcessAuthentication(LazyAsyncResult lazyResult)
at System.Net.Security.SslStream.AuthenticateAsClient(String targetHost, X509CertificateCollection clientCertificates, SslProtocols enabledSslProtocols, Boolean checkCertificateRevocation)
at MyAPP.Core.Services.Network.Impl.SslTcpClient.ClientSideHandshake()
at MyAPP.Core.Services.Network.Impl.SslTcpClient.Connect()
at MyAPP.Core.Services.Impl.MessageService.SendMessage(String message)
Что я могу сделать ?
5 ответов
Лучший ответ
Вот решение, записанное в реестре:
[HKEY_LOCAL_MACHINE SYSTEM CurrentControlSet Control SecurityProviders SCHANNEL KeyExchangeAlgorithms Diffie-Hellman] «ClientMinKeyBitLength» = dword: 00000200
Как указано здесь
10
Community
23 Май 2017 в 12:26
Я получил это исключение при использовании C# подключения к базе данных Oracle с помощью Oracle.ManagedDataAccess.dll,
«Oracle.ManagedDataAccess.Client.OracleException (0x80004005): Oracle не может подключиться к серверу или не может проанализировать строку подключения —> OracleInternal.Network.NetworkException (0x80004005): Oracle: Oracle не может подключиться к серверу или не может проанализировать строку подключения — > System.Security.Authentication.AuthenticationException: Ошибка вызова SSPI, см. Внутреннее исключение. —> System.ComponentModel.Win32Exception: В пакете безопасности нет учетных данных r n — Конец внутренней трассировки стека исключений — r n в System.Net.Security.NegoState.StartSendAuthResetSignal (LazyAsyncResult lazyResult, сообщение Byte [], исключение исключения) r n в System. Net.Security.NegoState.StartSendBlob (Byte [] сообщение, LazyAsyncResult lazyResult) r n в …………
И после долгих поисков и попыток я наконец нахожу Этот ответ работает, добавляю раздел settings и устанавливаю { {X1}} в app.config:
<oracle.manageddataaccess.client>
<version number="*">
<dataSources>
<dataSource alias="SampleDataSource" descriptor="(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=ORCL))) "/>
</dataSources>
<settings>
<setting name="SQLNET.AUTHENTICATION_SERVICES" value=""/>
</settings>
</version>
</oracle.manageddataaccess.client>
В справочной ссылке в ответе выше вы можете попробовать еще один шаг, установив:
SQLNET.AUTHENTICATION_SERVICES = ()
В папке sqlnet.ora в Oracle Client также работает.
0
yu yang Jian
18 Фев 2020 в 09:36
Попробуйте добавить servicePrincipalName в свой клиентский файл App.config
<client>
<endpoint ............................
<identity>
<servicePrincipalName/>
</identity>
</endpoint>
</client>
-1
Artur Strecker
11 Фев 2020 в 10:11
Это означает, что другая сторона использует другую версию TLS, а вы используете старую версию.
Перед подключением установите атрибут безопасности TLS12. Это широко известная проблема, поскольку многие провайдеры начинают использовать TLS12 (например, PayPal, Amazon и т. Д.).
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
19
Seymour
10 Апр 2018 в 18:29
Если вы используете SslStream, вам необходимо явно указать версию TLS в вызове AuthenticateAsClient, например:
ssl.AuthenticateAsClient(url, null, SslProtocols.Tls12, false);
3
Fiach Reid
16 Авг 2018 в 11:35