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

Adrian

Default.aspx.cs

WCFService.Service1Client client = new WCFService.Service1Client();
string stream = client.JsonSerializeFromDatabase();
client.Close();
WCFService.Service1Client client2 = new WCFService.Service1Client();
foreach (WCFService.Person in client2.JsonDeserializeFromDatabase(stream)) 

Service1.svc.cs

public IList<Person> JsonDeserializeFromDatabase(string value)
{
    MemoryStream ms = new MemoryStream(Encoding.ASCII.GetBytes(value));
    DataContractJsonSerializer ser = new DataContractJsonSerializer(typeof(List<Person>));
    IList<Person> tableData = (IList<Person>)ser.ReadObject(ms);
    ms.Close();
    ms.Dispose();

    return tableData;
}

IService1.cs

[OperationContract]
IList<Person> JsonDeserializeFromDatabase(string value);

Server Web.config

    <httpRuntime maxRequestLength="8192"/>
</system.web>
...
<system.serviceModel>
<services>
    <service name="TestWCF.Service1" behaviorConfiguration="TestWCF.Service1Behavior">
        <endpoint address="" binding="wsHttpBinding" contract="TestWCF.IService1">
            <identity>
                <dns value="localhost"/>
            </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
    </service>
</services>
<behaviors>
<serviceBehaviors>
    <behavior name="TestWCF.Service1Behavior">
    <serviceMetadata httpGetEnabled="true"/>
    <serviceDebug includeExceptionDetailInFaults="true"/>
    <dataContractSerializer maxItemsInObjectGraph="2147483646"/>
    </behavior>
</serviceBehaviors>

Client Web.config

    <httpRuntime maxRequestLength="8192"/>
</system.web>
<system.serviceModel>
    <behaviors>
        <endpointBehaviors>
            <behavior name="debuggingBehaviour">
                <dataContractSerializer maxItemsInObjectGraph="2147483646" />
            </behavior>
        </endpointBehaviors>
    </behaviors>
    <bindings>
        <wsHttpBinding>
            <binding name="WSHttpBinding_IService1" closeTimeout="00:50:00" openTimeout="00:50:00" receiveTimeout="00:50:00" sendTimeout="00:50:00" bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
            <readerQuotas maxDepth="64" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
            <reliableSession ordered="true" inactivityTimeout="00:50:00" enabled="false"/>
            <security mode="Message">
            <message clientCredentialType="Windows" negotiateServiceCredential="true" algorithmSuite="Default"/>
            </security>
        </binding>
    </wsHttpBinding>
</bindings>
<client>
    <endpoint address="~~~~~/Service1.svc" binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IService1" contract="WCFService.IService1" name="WSHttpBinding_IService1" behaviorConfiguration="debuggingBehaviour">

Exception Information
- Type: System.ServiceModel.CommunicationException, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- Message: An error occurred while receiving the HTTP response to ~~~~~/Service1.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 got this exception information from Server trace viewer, so please do not advise me to put <-system.diagnostics-> tag.

As you can see, I increased all the size thing.

Like.. i don't know why I am getting an error when I call JsonDeserializeFromDatabase(stream).
"An error occurred while receiving the HTTP response to ~~~~~/Service1.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."

patrickjlee

I too have experienced this error message when returning records from a database in a WCF service. As well as increasing maxReceivedMessageSize in the binding in the client configuration (App.config), a separate problem seems to be that WCF has problems serializing Entity Framework objects if they have relationships that lead to circularity in their object graphs.

I solved this by returning buddy class objects (which are copies of the raw database records, but without any relationship links) rather than the raw database classes themselves.

Hope this helps - And WHY doesn't Microsoft produce better error messages?? Here, as in many other cases, the error message gives no clue to the real problem (the serialization of the return value from the WCF call)!

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

An error occurred while receiving the HTTP response to ''. This could be due to the service endpoint binding not using the HTTP protocol

From Dev

Implementing WCF Service using HTTP protocol with encryption

From Dev

WCF Could not find a base address that matches scheme http for the endpoint with binding MetadataExchangeHttpBinding

From Dev

WCF Could not find a base address that matches scheme http for the endpoint with binding MetadataExchangeHttpBinding

From Dev

There Was No Endpoint Listening at http // That Could Accept The Message in WCF

From Dev

HTTP Endpoint for WCF Service in Azure Service Fabric

From Dev

Could not find endpoint element when consume WCF service

From Dev

WCF Exception: Could not find a base address that matches scheme http for the endpoint

From Dev

difference between a http binding and the tcp binding in wcf service

From Dev

WCF Client and Service Endpoints Using the Same Binding

From Dev

Could not load file or assembly using WCF service

From Dev

WCF Service - Endpoint is not showing

From Dev

WCF service binding settings

From Dev

WCF - Using more than one service certificate (due to certificate change)

From Dev

WCF http binding

From Dev

WCF Web Service MSMQ Endpoint

From Dev

WCF Endpoint not found for service interface

From Dev

Unable to access WCF service using NET.TCP binding

From Dev

Could not find a base address that matches scheme http for the endpoint with binding WSHttpBinding with NO SOLUTION YET

From Dev

Could not find a base address that matches scheme http for the endpoint with binding WSHttpBinding with NO SOLUTION YET

From Dev

Could not find endpoint element with name WCF

From Dev

Windows Impersonation in an on-premises WCF Service using an Azure Service Bus Endpoint

From Dev

Windows Impersonation in an on-premises WCF Service using an Azure Service Bus Endpoint

From Dev

WCF Restful Web Service Endpoint exposed but methods all return http 404 not found c#

From Dev

WCF Endpoint Error: Could not find default endpoint element

From Dev

WCF: No protocol binding matches the given address

From Dev

WCF service call using TAP pattern does not honor WCF binding timeout

From Dev

WCF Web Service Client no endpoint listening

From Dev

WCF Service Base Address vs endpoint address

Related Related

  1. 1

    An error occurred while receiving the HTTP response to ''. This could be due to the service endpoint binding not using the HTTP protocol

  2. 2

    Implementing WCF Service using HTTP protocol with encryption

  3. 3

    WCF Could not find a base address that matches scheme http for the endpoint with binding MetadataExchangeHttpBinding

  4. 4

    WCF Could not find a base address that matches scheme http for the endpoint with binding MetadataExchangeHttpBinding

  5. 5

    There Was No Endpoint Listening at http // That Could Accept The Message in WCF

  6. 6

    HTTP Endpoint for WCF Service in Azure Service Fabric

  7. 7

    Could not find endpoint element when consume WCF service

  8. 8

    WCF Exception: Could not find a base address that matches scheme http for the endpoint

  9. 9

    difference between a http binding and the tcp binding in wcf service

  10. 10

    WCF Client and Service Endpoints Using the Same Binding

  11. 11

    Could not load file or assembly using WCF service

  12. 12

    WCF Service - Endpoint is not showing

  13. 13

    WCF service binding settings

  14. 14

    WCF - Using more than one service certificate (due to certificate change)

  15. 15

    WCF http binding

  16. 16

    WCF Web Service MSMQ Endpoint

  17. 17

    WCF Endpoint not found for service interface

  18. 18

    Unable to access WCF service using NET.TCP binding

  19. 19

    Could not find a base address that matches scheme http for the endpoint with binding WSHttpBinding with NO SOLUTION YET

  20. 20

    Could not find a base address that matches scheme http for the endpoint with binding WSHttpBinding with NO SOLUTION YET

  21. 21

    Could not find endpoint element with name WCF

  22. 22

    Windows Impersonation in an on-premises WCF Service using an Azure Service Bus Endpoint

  23. 23

    Windows Impersonation in an on-premises WCF Service using an Azure Service Bus Endpoint

  24. 24

    WCF Restful Web Service Endpoint exposed but methods all return http 404 not found c#

  25. 25

    WCF Endpoint Error: Could not find default endpoint element

  26. 26

    WCF: No protocol binding matches the given address

  27. 27

    WCF service call using TAP pattern does not honor WCF binding timeout

  28. 28

    WCF Web Service Client no endpoint listening

  29. 29

    WCF Service Base Address vs endpoint address

HotTag

Archive