WCF Web服务无法使用https进行连接



我已经拔头发一周了,现在正试图获得一个现有的web服务可以在https下工作。web服务在在https下,但尝试通过客户端进行交互时失败。我有阅读所有内容并尝试了许多app.config和web的组合配置并需要更多的眼睛。这是我的东西。

应用程序配置

<?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>

<system.serviceModel>

错误返回

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(TimeSpan超时(
System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChanelRequest.SendRequest(消息消息,TimeSpan超时(System.ServiceModel.Channels.RequestChannel.Request(消息消息,TimeSpan超时(System.ServiceModel.Dispatcher.RequestChannelBinder.Request(消息消息,TimeSpan超时(System.ServiceModel.Channels.ServiceChannel.Call(字符串操作,布尔单向,ProxyOperationRuntime操作,Object[]ins,Object[]out,TimeSpan超时(System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessagemethodCall,ProxyOperationRuntime操作(System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage消息(

在[0]处重新引发异常:在System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessagereqMsg、IMessage retMsg(System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&msgData,Int32类型(ScanDocumentWcfClient.GetScanForms((

内部异常:无法连接到位于的远程服务器System.Net.HttpWebRequest.GetRequestStream(TransportContext&context(位于的System.Net.HttpWebRequest.GetRequestStream((System.ServiceModel.Channels.HttpOutput.WebRequestHttpOutput.GetOutputStream((

内部异常:连接尝试失败,因为连接的当事人在一段时间后没有做出适当回应,或者连接失败,因为连接的主机无法响应195.168.2.145:443,位于System.Net.Socket.Socket.DoConnect(端点endPointSnapshot,SocketAddress SocketAddress(System.Net.ServicePoint.ConnectSocketInternal(布尔连接失败,插座s4、插座s6、插座&套接字,IPAddress&住址ConnectSocketState状态,IAsyncResult异步结果,异常&例外(

web服务对使用HTTP还是HTTPS有重大影响。

您可以查看下面的链接,找到一些有用的信息:WCF服务在通过HTTPS和HTTP访问时不工作。

谢谢。

当我将服务名称更改为与Contract相同的名称时,这个问题就解决了。

<服务名称=";MySiteLibrary.Services.ScanDocumentWcf";到<服务名称=";IScanDocumentWcf";

最新更新