c# - WCF Web 服务无法使用 https 进行连接
问题描述
一个星期以来一直在努力让现有的工作网络服务在 https 下工作。Web 服务在 https 下广告正常,但在尝试通过客户端交互时失败。我已经阅读了所有内容并尝试了许多 app.config 和 Web 配置的组合,需要更多的关注。这就是我所拥有的。
应用程序配置
<?xml version="1.0" encoding="utf-8"?>
网络配置
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
<protocolMapping>
<add scheme="http" binding="basicHttpBinding" bindingConfiguration="" />
<add scheme="https" binding="basicHttpsBinding" bindingConfiguration="BasicHttpBinding_IScanDocumentWcf" />
</protocolMapping>
<diagnostics>
<messageLogging logEntireMessage="true" logMalformedMessages="true" logMessagesAtServiceLevel="true" logMessagesAtTransportLevel="true" maxMessagesToLog="3000000" maxSizeOfMessageToLog="2000000" />
</diagnostics>
<bindings>
<basicHttpsBinding>
<binding name="BasicHttpBinding_IScanDocumentWcf" maxReceivedMessageSize="2000000000" closeTimeout="01:00:00" openTimeout="01:00:00" receiveTimeout="01:00:00" sendTimeout="01:00:00">
<security mode="Transport">
<transport clientCredentialType="None" proxyCredentialType="None" realm=""/>
<message clientCredentialType="Certificate" algorithmSuite="Default" />
</security>
</binding>
</basicHttpsBinding>
</bindings>
<services>
<service name="MySiteLibrary.Services.ScanDocumentWcf" behaviorConfiguration="serviceHttpsBehavior">
<endpoint address="" binding="basicHttpsBinding" contract="MySiteLibrary.Services.IScanDocumentWcf" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="serviceFaultBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
<behavior name="serviceHttpsBehavior">
<serviceMetadata httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
返回错误
There was no endpoint listening at https://webscan.MySite.com/ScanDocumentWcf.svc that could accept the
信息。这通常是由不正确的地址或 SOAP 操作引起的。有关更多详细信息,请参阅 InnerException(如果存在)。
服务器堆栈跟踪:在 System.ServiceModel.Channels.HttpOutput.Send(TimeSpan 超时)的 System.ServiceModel.Channels.HttpOutput.WebRequestHttpOutput.GetOutputStream()
在 System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.SendRequest(消息消息,TimeSpan 超时)在 System.ServiceModel.Channels.RequestChannel.Request(消息消息,TimeSpan 超时)在 System.ServiceModel.Dispatcher.RequestChannelBinder.Request (消息消息,TimeSpan 超时)在 System.ServiceModel.Channels.ServiceChannel.Call(字符串操作,布尔单向,ProxyOperationRuntime 操作,Object[] 输入,Object[] 输出,TimeSpan 超时)在 System.ServiceModel.Channels.ServiceChannelProxy.InvokeService System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage 消息)处的(IMethodCallMessage 方法调用、ProxyOperationRuntime 操作)在 [0] 处重新抛出异常:在 System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) 在 IScanDocumentWcf.GetScanForms( ) 在 ScanDocumentWcfClient.GetScanForms()
内部异常:无法在 System.ServiceModel.Channels.HttpOutput.WebRequestHttpOutput.GetOutputStream() 的 System.Net.HttpWebRequest.GetRequestStream() 的 System.Net.HttpWebRequest.GetRequestStream(TransportContext& context) 连接到远程服务器
内部异常:连接尝试失败,因为连接方在一段时间后没有正确响应,或者建立连接失败,因为连接的主机在 System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot) 未能响应 195.168.2.145:443 , SocketAddress socketAddress) 在 System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception)
解决方案
推荐阅读
- java - 防止自定义 Bean 内的地图中的空值通过 Jackson 序列化
- node.js - 仅在 mysql 中使用 knex 的某些情况下为表列添加唯一性
- angular - HttpParams 不发送带有空白字符串的参数
- python - Python struct.unpack("i", bytearray(data)) 到 Swift 4
- typescript - 如何在 Typescript 中键入深度对象解构?
- dart - 将 Widget 与 State 分离
- javascript - 将仅具有特定文件扩展名的图像导入 Photoshop
- java - JMeter,对样本进行后处理
- html - 如何包含 MPEG 编解码器?
- virtual-machine - 如何在 Singularity 容器中启动 VM?