我有一个简单的Web服务调用,由.NET(C#)2.0 Windows应用程序通过Visual Studio生成的Web服务代理生成,用于也用C#(2.0)编写的Web服务.这已经工作了几年,并且在它运行的十几个地方继续这样做.
新站点的新安装遇到问题.尝试调用Web服务时,它失败并显示以下消息:
无法为SSL/TLS安全通道建立信任关系
Web服务的URL使用SSL(https://) - 但这已经在很多其他位置工作了很长时间(并且仍在继续).
我在哪里看?这可能是Windows和.NET之间的安全问题吗?如果是这样,我在哪里建立信任关系?我迷路了!
我收到这个错误:
根据验证程序,远程证书无效.
每当我尝试使用我的C#代码中的Gmail SMTP服务器发送电子邮件时.有人能指出我找到解决这个问题的正确方向吗?
以下是堆栈跟踪...
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.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 …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用Fiddler来帮助某人解决Invoke-RestMethod调用ASP.NET WebAPI的问题.不幸的是,当我Invoke-RestMethod在PowerShell中调用时,Fiddler并没有拦截HTTP通信.
当我使用Internet Explorer浏览作为同一应用程序一部分的ASP.NET网站的根目录时,Fiddler会按预期拦截流量.
任何人都可以解释为什么Fiddler没有通过PowerShell捕获HTTP流量,以及如何解决这个问题?
我正在尝试使用C#让RabbitMQ 3.6.2在Windows 7上针对Erlang 18.0使用SSL/TLS.当我在C#代码中启用SSL时,我遇到了错误.我已经通过建立SSL/TLS的步骤了这里.我也经历了[故障排除步骤] [2],显示出成功(除了由于缺乏对stunnel的了解而无法完成stunnel步骤).这是我的C#代码试图连接到RabbitMQ:
var factory = new ConnectionFactory()
{
// NOTE: guest username ONLY works with HostName "localhost"!
//HostName = Environment.MachineName,
HostName = "localhost",
UserName = "guest",
Password = "guest",
};
// Without this line, RabbitMQ.log shows error: "SSL: hello: tls_handshake.erl:174:Fatal error: protocol version"
// When I add this line to go to TLS 1.2, .NET throws an exception: The remote certificate is invalid according to the validation procedure.
// https://stackoverflow.com/questions/9983265/the-remote-certificate-is-invalid-according-to-the-validation-procedure:
// Walked through this tutorial …Run Code Online (Sandbox Code Playgroud) 每次我尝试通过 VS2015 和 IIS Express 在我的开发盒上运行我的 MVC 项目时,我都会收到一个错误。它使用此代码对我们的 ADFS 服务器进行身份验证。
app.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType);
app.UseCookieAuthentication(new CookieAuthenticationOptions());
app.UseWsFederationAuthentication(
new WsFederationAuthenticationOptions
{
Wtrealm = realm,
MetadataAddress = adfsMetadata
});
Run Code Online (Sandbox Code Playgroud)
这是我在浏览器中遇到的错误。
[AuthenticationException: 根据验证程序,远程证书无效。]
System.Net.TlsStream.EndWrite(IAsyncResult asyncResult) +231
System.Net.PooledStream.EndWrite(IAsyncResult asyncResult) +15
System.Net.ConnectStream.WriteHeadersCallback(IAsyncResult) ar) +119[WebException: 底层连接已关闭:无法为 SSL/TLS 安全通道建立信任关系。]
System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult) +606 System.Net.Http.HttpClientHandler.GetResponseCallback(IAsyncResult ar) + 64[HttpRequestException: 发送请求时发生错误。]
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +92
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +58 System.Runtime.CompilerServices.TaskAwaiter` 1.GetResult() +28 Microsoft.IdentityModel.Protocols.d__0.MoveNext() +453[IOException:无法从以下位置获取文档:https://adfs.DOMAIN.com/FederationMetadata/2007-06/FederationMetadata.xml] Microsoft.IdentityModel.Protocols.d__0.MoveNext() +830 System.Runtime.CompilerServices.TaskAwaiter。 ThrowForNonSuccess(Task task) +92
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +58 System.Runtime.CompilerServices.TaskAwaiter1.GetResult() +28 Microsoft.IdentityModel.Protocols.<GetAsync>d__1.MoveNext() +606 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +92 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) …