【发布时间】:2021-09-28 23:18:18
【问题描述】:
现在已经拔了一个星期的头发,试图让一个现有的、工作的 Web 服务在 https 下工作。网络服务广告很好,而 在 https 下,但尝试通过客户端交互时失败。我有 阅读所有内容并尝试了许多 app.config 和 web 的组合 配置和需要更多的眼睛。这是我所拥有的。
App.Config
<?xml version="1.0" encoding="utf-8"?>
Web.Config
<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>
错误返回
There was no endpoint listening at https://webscan.MySite.com/ScanDocumentWcf.svc that could accept the消息。这通常是由不正确的地址或 SOAP 操作引起的。 有关详细信息,请参阅 InnerException(如果存在)。
服务器堆栈跟踪:在 System.ServiceModel.Channels.HttpOutput.WebRequestHttpOutput.GetOutputStream() 在 System.ServiceModel.Channels.HttpOutput.Send(时间跨度超时)
在 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(字符串动作, Boolean oneway, ProxyOperationRuntime 操作, Object[] ins, Object[] 出局,TimeSpan 超时)在 System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall,ProxyOperationRuntime 操作)在 System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage 留言)在 [0] 处重新抛出异常:在 System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg,IMessage retMsg)在 System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(消息数据& msgData,Int32 类型)在 IScanDocumentWcf.GetScanForms() 在 ScanDocumentWcfClient.GetScanForms()
内部异常:无法连接到远程服务器 System.Net.HttpWebRequest.GetRequestStream(TransportContext& 上下文) 在 System.Net.HttpWebRequest.GetRequestStream() 在 System.ServiceModel.Channels.HttpOutput.WebRequestHttpOutput.GetOutputStream()
内部异常:连接尝试失败,因为已连接 当事人在一段时间后没有正确回应,或建立 连接失败,因为连接的主机没有响应 195.168.2.145:443 在 System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress) 在 System.Net.ServicePoint.ConnectSocketInternal(布尔连接失败, Socket s4, Socket s6, Socket&socket, IPAddress&地址, ConnectSocketState 状态、IAsyncResult asyncResult、Exception& 例外)
【问题讨论】:
标签: c# https wcf-binding