This could be due to the service endpoint binding not using the HTTP protocol

190,042

Solution 1

I figured out the problem. It ended up being a path to my config file was wrong. The errors for WCF are so helpful sometimes.

Solution 2

I think there is serialization problem, you can find exact error just need to add below code in service config in <configuration> section.

After config update "App_tracelog.svclog" file will create, where your service exist just need to open .svclog file and find red color line on left side panel which is error and see its description for more info.

I hope this will help to find your error.

<configuration>
...
...

<system.diagnostics>
    <sources>
      <source name="System.ServiceModel.MessageLogging" switchValue="Warning, ActivityTracing">
        <listeners>
          <add name="ServiceModelTraceListener" />
        </listeners>
      </source>
      <source name="System.ServiceModel" switchValue="Verbose,ActivityTracing">
        <listeners>
          <add name="ServiceModelTraceListener" />
        </listeners>
      </source>
      <source name="System.Runtime.Serialization" switchValue="Verbose,ActivityTracing">
        <listeners>
          <add name="ServiceModelTraceListener" />
        </listeners>
      </source>
    </sources>
    <sharedListeners>
      <add initializeData="App_tracelog.svclog" type="System.Diagnostics.XmlWriterTraceListener, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" name="ServiceModelTraceListener" traceOutputOptions="Timestamp" />
    </sharedListeners>
  </system.diagnostics>

  </configuration>

Update: If you will not able to find updated "App_tracelog.svclog" file then please find "<some GUID>App_tracelog.svclog" like "a39e3026-5dd8-4d39-842a-04d486615eedApp_tracelog.svclog"

Solution 3

I had this problem "This could be due to the service endpoint binding not using the HTTP protocol" and the WCF service would shut down (in a development machine)

I figured out: in my case, the problem was because of Enums,

I solved using this

    [DataContract]
    [Flags]
    public enum Fruits
    {
        [EnumMember]
        APPLE = 1,
        [EnumMember]
        BALL = 2,
        [EnumMember]
        ORANGE = 3 

    }

I had to decorate my Enums with DataContract, Flags and all each of the enum member with EnumMember attributes.

I solved this after looking at this msdn Reference:

Solution 4

I've had this same error and the problem was serialization. I managed to find the real problem using Service Trace Viewer http://msdn.microsoft.com/en-us/library/ms732023.aspx and solved it easy. Maybe this will help someone.

Solution 5

In my instance, the error was generated because one of my complex types had a property with no set method.

The serializer threw an exception because of that fact. Added internal set methods and it all worked fine.

Best way to find out why this is happening (in my opinion) is to enable trace logging.

I achieved this by adding the following section to my web.config:

<system.diagnostics>
  <sources>
    <source name="System.ServiceModel.MessageLogging" switchValue="Warning,ActivityTracing">
      <listeners>
        <add name="traceListener"
              type="System.Diagnostics.XmlWriterTraceListener"
              initializeData= "c:\log\Traces.svclog" />
        <add type="System.Diagnostics.DefaultTraceListener" name="Default" />
      </listeners>
    </source>
    <source propagateActivity="true" name="System.ServiceModel" switchValue="Verbose,ActivityTracing">
      <listeners>
        <add name="traceListener"
              type="System.Diagnostics.XmlWriterTraceListener"
              initializeData= "c:\log\Traces.svclog" />
        <add type="System.Diagnostics.DefaultTraceListener" name="Default" />
      </listeners>
    </source>
  </sources>
  <trace autoflush="true" />
</system.diagnostics>

Once set, I ran my client, got exception and checked the 'Traces.svclog' file. From there, I only needed to find the exception.

Share:
190,042
Matt Schubert
Author by

Matt Schubert

Updated on January 15, 2022

Comments

  • Matt Schubert
    Matt Schubert over 2 years

    I have a WCF Service running fine on my local machine. I put it on the servers, and I am receiving the following error:

    An error occurred while receiving the HTTP response to http://xx.xx.x.xx:8200/Services/WCFClient.svc. This could be due to the service endpoint binding not using the HTTP protocol. This could also be due to an HTTP request context being aborted by the server (possibly due to the service shutting down). See server logs for more details.]

    I have gone to the service in the url and it is working correctly. All I am doing for the function is returning a string to an image name, so the data being passed isn't a lot. I have traced the log and it gives me the same information. Here is my client config:

    <binding name="basicHttpBinding_IWCFClient" closeTimeout="00:01:00"
             openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
             bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
             maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
             messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
             allowCookies="false">
        <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" 
                      maxArrayLength="2147483647" maxBytesPerRead="2147483647" 
                      maxNameTableCharCount="2147483647" />
        <security mode="None">
            <transport clientCredentialType="None" proxyCredentialType="None" realm="" />
            <message clientCredentialType="UserName" algorithmSuite="Default" />
        </security>
    </binding>
    <endpoint name="basicHttpBinding_IWCFClient" 
        address="http://localhost:4295/Services/WCFClient.svc"
        binding="basicHttpBinding" 
        bindingConfiguration="basicHttpBinding_IWCFClient" 
        behaviorConfiguration="WCFGraphicManagementTool.Services.ClientBehavior"
        contract="WCFClient.IWCFClient" />
    

    Here is my server config:

    <service behaviorConfiguration="WCFGraphicManagementTool.Services.WCFClientBehavior"
        name="WCFGraphicManagementTool.Services.WCFClient">
       <endpoint name="basicHttpBinding_IWCFClient"
           address="" 
           binding="basicHttpBinding" 
           contract="WCFGraphicManagementTool.Contracts.IWCFClient" />
       <endpoint 
           address="mex" 
           binding="mexHttpBinding" 
           contract="IMetadataExchange" />
    </service>
    <behavior name="WCFGraphicManagementTool.Services.WCFClientBehavior">
       <dataContractSerializer maxItemsInObjectGraph="2147483647" />
       <serviceThrottling maxConcurrentCalls="120" maxConcurrentSessions="120"
                          maxConcurrentInstances="120" />
       <serviceMetadata httpGetEnabled="true" />
       <serviceDebug includeExceptionDetailInFaults="true" />
    </behavior>
    

    Would it be a setting on the server since it works on my local machine?