Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8348031
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T07:33:59+00:00 2026-06-09T07:33:59+00:00

I have a WCF service and in this service I return a class with

  • 0

I have a WCF service and in this service I return a class with lots of properties, some of which are classes themselves and it is a little complex but not hugely. I’ve done a similar thing on the same project with another WCF service and it all worked fine. But this one gave me this error when I used it.

[System.ServiceModel.CommunicationException]    {"An error occurred while receiving the HTTP response to http://xxx/Service.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."}  System.ServiceModel.CommunicationException

The inner exception is

[System.Net.WebException]   {"The underlying connection was closed: An unexpected error occurred on a receive."}    System.Net.WebException

The inner exception of that says

[System.IO.IOException] {"Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host."}   System.IO.IOException

The inner exception of that says

[System.Net.Sockets.SocketException]    {"An existing connection was forcibly closed by the remote host"}   System.Net.Sockets.SocketException

So, here’s what I’ve tried. I thought that maybe there is some error in my .svc file or perhaps there is some error in my configuration of the .config files, but as far as I can see there isn’t. Then, I thought I should try and see if I can send a simple type from the server to the client. I therefore created a method called GetInt() which returns 7. I called this on the client and it worked fine. Therefore, I think it is the data that I’m sending back from the server that is not supported. I can’t see why, because as I’ve said I’ve sent complex types before on the same project (just yesterday) and it all worked. Anyway, here is my class that I am sending. Perhaps, someone can point out what might not be supported. Or perhaps someone knows what else might have caused this.

    public class Hotels
    {
        public string Language { get; set; }
        public string Datum { get; set; }
        public  List<HotelListing> HotelListing { get; set; }
    }

    public class HotelListing
    {
        public long Id { get; set; }
        public string Name { get; set; }
        public string Country { get; set; }
        public decimal Latitude { get; set; }
        public decimal Longitude { get; set; }
        public string Category { get; set; }
        public List<PhoneNumber> PhoneNumbers { get; set; }
        public Address Address { get; set; }
        public Content Content { get; set; }
    }

    public class Content
    {
        public Description Description { get; set; }
        public List<Review> Reviews { get; set; }
        public Image Image { get; set; }
        public AtrttributeData AtrttributeData { get; set; }
    }

    public class AtrttributeData
    {
        public string Link { get; set; }
        public string Title { get; set; }
        public NameValueCollection Attributes { get; set; }
    }

    public class Image
    {
        public string Type { get; set; }
        public string ImageURL { get; set; }
        public string HotelURL { get; set; }
    }

    public class Review
    {
        public string Type { get; set; }
        public string Link { get; set; }
        public string Author { get; set; }
        public string Body { get; set; }
        public NameValueCollection Ratings { get; set; } 
    }

    public class Description
    {
        public string Link { get; set; }
        public string Title { get; set; }
        public string Body { get; set; }
    }

    public class Address
    {
        public string Format { get; set; }
        public string Addr1 { get; set; }
        public string Addr2 { get; set; }
        public string City { get; set; }
        public string PostCode { get; set; }
    }

    public class PhoneNumber
    {
        public string Type { get; set; }
        public string Number { get; set; }
    }

The method in question is this

[OperationContract]
Hotels GetHotels();

Any help would be greatly appreciated.

Here is my configuration section

<binding name="BasicHttpBinding_ITablet" closeTimeout="00:01:00"
                    openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
                    allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
                    maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
                    messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
                    useDefaultWebProxy="true">
                    <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                        maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                    <security mode="None">
                        <transport clientCredentialType="None" proxyCredentialType="None"
                            realm="" />
                        <message clientCredentialType="UserName" algorithmSuite="Default" />
                    </security>
                </binding>

<snip>

<endpoint address="http://xxx/Service.svc"
                binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ITablet"
                contract="SupplierInterfaceTabletService.ITablet" name="BasicHttpBinding_ITablet" />

thanks,

Sachin

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T07:34:01+00:00Added an answer on June 9, 2026 at 7:34 am

    Try return DataContract (not Class). This a DataContract with a list of another DataContract and an example of inheritance.

    [DataContract]
    public class sDoc
    {
        [DataMember]
        public int sID;
        [DataMember]
        public int sParID;
        [DataMember]
        public List<sDocProp> Props;
        [DataMember]
        public string SessionID;
    
        public string NotDataMember;
    }
    
    [DataContract]
    [KnownType(typeof(sDocPropStringSV))]
    public class sDocProp
    {
        [DataMember]
        public int ID;
        [DataMember]
        public string Name;
        [DataMember]
        public ArrivalStatus ArrivalStatus;
    }
    
    [DataContract]
    public class sDocPropStringSV : sDocProp
    {
        [DataMember]
        public string Value;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a WCF service. I can return a concrete class without a problem,
I have a WCF service which all operations return type is OperationStatus: [DataContract] public
I have a WCF service with a security class for getting some of the
Hello I have a simple wcf service like this, with a test method which
I have a WCF service method which I have written for return type as
I am trying to return some JSON from a WCF service. This service simply
I have a WCF service that returns a stream object. But for some reason
I have a WCF Service like this: [ServiceContract] public class SomeService { [WebInvoke(UriTemplate =
I have a wcf service which exposes a function that returns a complex type
I have a wcf service defined like this: [OperationContract] [WebInvoke(Method = POST, ResponseFormat =

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.