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 4250856
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T04:35:01+00:00 2026-05-21T04:35:01+00:00

Bit of background on my question… I have a website and multiple console apps

  • 0

Bit of background on my question…

I have a website and multiple console apps that access the same data layer (Linq-To-Sql) to set/get data. The console apps run across our network and they all update the central database via WCF services. The website is used to display the data captured by the apps data to the users.

My WCF services works when I’m returning simple types and when I’m returning lists of my custom objects BUT my service falls over with an ‘underlying connection was closed error’ whenever I try and return anything within an IEnumerable/IQueryable.

I thought it was possible to return IEnumerables/IQueryables over WCFs services ? Is is possible, or, am I just configuring my service wrong ? I’m using basicHttpBinding instead of wsHttpBinding but I’m still not 100% in what situation it is best to use the different types.

My set-up is like this :

public class CageService : ICageRepository
{
        public IEnumerable<Cage> GetAll()
        {
            var dc = new DataContext();
            return dc .GetAll();
        }
}


[ServiceContract]
public interface ICageRepository : IRepository<Cage>
{
    [OperationContract]
    IEnumerable<Cage> GetAll();

}

Service Config :

  <system.serviceModel>

    <services>
      <!-- Note: the service name must match the configuration name for the service implementation. -->
      <service name="CageService" behaviorConfiguration="CageServiceTypeBehaviors" >
        <host>
          <baseAddresses>
            <add baseAddress = "http://localhost/UHFWebsite/" />
          </baseAddresses>
        </host>
        <!-- Add the following endpoint.  -->
        <!-- Note: your service must have an http base address to add this endpoint. -->
        <endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex" />


        <endpoint address ="" binding="basicHttpBinding" contract="Wavin.CageTracking.DataLayer.Interfaces.ICageRepository" />
      </service>
    </services>

    <behaviors>
      <serviceBehaviors>
        <behavior name="CageServiceTypeBehaviors" >
          <!-- Add the following element to your service behavior configuration. -->
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="true" />
        </behavior>
      </serviceBehaviors>
    </behaviors>

  </system.serviceModel>

Client config:

<system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="BasicHttpBinding_ICageRepository1" 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>
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="http://localhost:2000/UHFServices/CageService.svc"
        binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ICageRepository1"
        contract="CageRepositoryClient.ICageRepository" name="BasicHttpBinding_ICageRepository1" />
    </client>
  </system.serviceModel>

calling code looks like:

void method()
{
            var client = new CageRepositoryClient();
            CageListView.DataSource = client.GetAll();;
            CageListView.DataBind();
}
  • 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-05-21T04:35:02+00:00Added an answer on May 21, 2026 at 4:35 am

    You need to add the Cage class to the known types of your service in the implementation of your interface.

    [ServiceBehavior]
    [ServiceKnownType(typeof(Cage))] 
    public class CageRepository: ICageRepository
    {
    ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First a bit of background: We have a growing RESTful service layer supporting web
I have to run a bit of code in the background every one second,
Bit of an unusual question, but I have setup a field inside a MySQL
Let me pose a bit of background information before asking my question: I recently
First a bit of background: I have a WPF application, which is a GUI-front-end
This is an odd problem, so I have to provide a bit of background.
A bit of background: I'm building an MVC app to store golf course data
First a little bit of background: I have a REST service in WCF 4
So for a bit of background, I am creating a website with the Zend
This is a bit maddening. I have code which saves the current background-image from

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.