0

I'm working on solution that uploads large amount of data through WCF web service to the server using HTTPS. My infrastructure design like this:

Client application <-- HTTPS --> ISA server <-- HTTP --> WCF web service

The web service hosted on IIS6, Windows server 2003. I use basicHttpBindings. When I start upload 2MB of data I receive: An error occurred while making the HTTP request to https://myservice.com/WcfService/service.svc/basic. This could be due to the fact that the server certificate is not configured properly with HTTP.SYS in the HTTPS case. This could also be caused by a mismatch of the security binding between the client and the server

But when I try to upload 100Kb everything works fine. Why? Please any suggestions.

Full exception message:

System.ServiceModel.CommunicationException was unhandled

Message=An error occurred while making the HTTP request to https://myservice.com/WcfService/service.svc/basic. This could be due to the fact that the server certificate is not configured properly with HTTP.SYS in the HTTPS case. This could also be caused by a mismatch of the security binding between the client and the server.

Source=mscorlib

StackTrace:

Server stack trace: 

   at System.ServiceModel.Channels.HttpChannelUtilities.ProcessGetResponseWebException(WebException webException, HttpWebRequest request, HttpAbortReason abortReason)

   at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)

   at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)

   at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)

   at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)

   at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)

   at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

Exception rethrown at [0]: 

   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)

   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)

   at ServiceWcfServiceMetadata.IServiceService.PutEmployeesCompressed(Transfer employees)

   at TestClient.ServiceService.PutEmployeesCompressed(Transfer employees) in C:\_WorkProjects\ServiceWCFIntegrationServices\TestClient\ServiceService.cs:line 61

   at TestClient.Program.Main(String[] args) in C:\_WorkProjects\ServiceWCFIntegrationServices\TestClient\Program.cs:line 60

   at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)

   at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)

   at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()

   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)

   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)

   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)

   at System.Threading.ThreadHelper.ThreadStart()

InnerException: System.Net.WebException

   Message=The underlying connection was closed: An unexpected error occurred on a send.

   Source=System

   StackTrace:

        at System.Net.HttpWebRequest.GetResponse()

        at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)

   InnerException: System.IO.IOException

        Message=Unable to write data to the transport connection: An existing connection was forcibly closed by the remote host.

        Source=System

        StackTrace:

             at System.Net.Sockets.NetworkStream.MultipleWrite(BufferOffsetSize[] buffers)

             at System.Net.Security._SslStream.StartWriting(SplitWritesState splitWrite, SplitWriteAsyncProtocolRequest asyncRequest)

             at System.Net.Security._SslStream.ProcessWrite(BufferOffsetSize[] buffers, SplitWriteAsyncProtocolRequest asyncRequest)

             at System.Net.TlsStream.MultipleWrite(BufferOffsetSize[] buffers)

             at System.Net.Connection.Write(ScatterGatherBuffers writeBuffer)

             at System.Net.ConnectStream.ResubmitWrite(ConnectStream oldStream, Boolean suppressWrite)

        InnerException: System.Net.Sockets.SocketException

             Message=An existing connection was forcibly closed by the remote host

             Source=System

             ErrorCode=10054

             NativeErrorCode=10054

             StackTrace:

                  at System.Net.Sockets.Socket.MultipleSend(BufferOffsetSize[] buffers, SocketFlags socketFlags)

                  at System.Net.Sockets.NetworkStream.MultipleWrite(BufferOffsetSize[] buffers)

             InnerException:

Basic Http Bindigs Configuration on Client:

<system.serviceModel>
<behaviors>
  <endpointBehaviors>
    <behavior name="BasicHttpBinding_IServiceServiceBehavior">
      <clientCredentials>
        <serviceCertificate>
          <authentication certificateValidationMode="None"/>
        </serviceCertificate>
      </clientCredentials>
    </behavior>
  </endpointBehaviors>
</behaviors>
<bindings>
  <basicHttpBinding>
    <binding name="BasicHttpBinding_IServiceService" closeTimeout="00:01:00"
      openTimeout="00:01:00" receiveTimeout="01:00:00" sendTimeout="01:00:00"
      allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
      maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
      messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true">
      <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
        maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
      <security mode="Transport">
        <transport clientCredentialType="Certificate" proxyCredentialType="None"
          realm="" />
      </security>
    </binding>
    <binding name="Local_IServiceService" closeTimeout="00:01:00"
      openTimeout="00:01:00" receiveTimeout="01:00:00" sendTimeout="01:00:00"
      allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
      maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
      messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true">
      <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
        maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
      <security mode="TransportCredentialOnly">
        <transport clientCredentialType="Windows" proxyCredentialType="None"
          realm="" />
      </security>
    </binding>
    <binding name="SecureBasic" maxBufferSize="100000000" maxBufferPoolSize="100000000"
      maxReceivedMessageSize="100000000">
      <readerQuotas maxDepth="100000000" maxStringContentLength="100000000"
        maxArrayLength="100000000" maxBytesPerRead="100000000" maxNameTableCharCount="100000000" />
      <security mode="Transport" />
    </binding>
  </basicHttpBinding>
</bindings>
<client>
  <endpoint address="https://myservice.com/WcfService/service.svc/basic"
    behaviorConfiguration="BasicHttpBinding_IServiceServiceBehavior"
    binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IServiceService"
    contract="ServiceWcfServiceMetadata.IServiceService" name="BasicHttpBinding_IServiceService" />
</client>

WCF Web Service configuration:

<system.serviceModel>
    <bindings>
        <basicHttpBinding>
            <binding name="DefaultBasic" maxBufferSize="2147483647" maxBufferPoolSize="2147483647"
                maxReceivedMessageSize="2147483647" transferMode="Buffered">
                <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
                    maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
                <security mode="None">
                    <transport clientCredentialType="None" proxyCredentialType="None" />
                </security>
            </binding>
        </basicHttpBinding>
    </bindings>
    <standardEndpoints />
    <behaviors />
    <services>
        <service behaviorConfiguration="" name="ServiceWcfServiceApplication.ServiceService">
            <endpoint address="basic" binding="basicHttpBinding" bindingConfiguration="DefaultBasic"
                name="Basic" bindingName="" contract="ServiceWcfServiceMetadata.IServiceService" />
        </service>
    </services>
</system.serviceModel>
Max Kilovatiy
  • 798
  • 1
  • 11
  • 32
  • 1
    have you tried to turn on WCF logging and see if there is anything strange? – ie. Sep 08 '12 at 17:59
  • 1
    please see http://msdn.microsoft.com/en-us/library/ms730064.aspx – ie. Sep 08 '12 at 18:05
  • It would help if you edit your question and trim it a bit, preferably down to the relevant bits, but in any case try to make it easier to read. You'll get better answers that way. – Jeroen Sep 09 '12 at 08:27
  • Possible duplicate of [WCF Error "This could be due to the fact that the server certificate is not configured properly with HTTP.SYS in the HTTPS case"](https://stackoverflow.com/questions/2013880/wcf-error-this-could-be-due-to-the-fact-that-the-server-certificate-is-not-conf) – kenorb Oct 02 '18 at 16:32

0 Answers0