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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T18:56:23+00:00 2026-06-06T18:56:23+00:00

I have a service with below code TaskService.svc [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)] public class TodoService

  • 0

I have a service with below code

TaskService.svc

[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class TodoService : ITodoService
{
    private readonly List<Todo> _dataSource;

    public TodoService()
    {
        _dataSource = new List<Todo>();
    }

    [WebGet(UriTemplate = "/Todos")]
    public List<Todo> Todos()
    {
        return _dataSource;
    }
}

and the data transfer object is as below

[ServiceContract]
public interface ITodoService
{
    [OperationContract]        
    List<Todo> Todos();
}

[DataContract]
public class Todo
{
    [DataMember]
    public string Name { get; set; }

    [DataMember]
    public bool Completed { get; set; }

}

the web.config as below

<services>
  <service name="SampleService.TodosBehavior">
    <endpoint address="" behaviorConfiguration="SampleService.TodosBehavior"
      binding="webHttpBinding" contract="SampleService.TodoService" />
  </service>
</services>
<behaviors>
  <endpointBehaviors>
    <behavior name="SampleService.TodosBehavior">
      <enableWebScript />
    </behavior>
  </endpointBehaviors>
  <serviceBehaviors>
    <behavior name="">
      <serviceMetadata httpGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="false" />
    </behavior>
  </serviceBehaviors>
</behaviors>

the application is hosted in IIS 7 with virtual directory SampleService. When ever i invoke using browser http://localhost/SampleService/TaskService.svc/Todos i am greeted with nothing. But i expected a empty array. Why is this so?

  • 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-06T18:56:26+00:00Added an answer on June 6, 2026 at 6:56 pm

    I think the WebGet() needs to be in your interface (ServiceContract) rather than your implementation of that interface. Also, do you need the slash before “Todos” in your UriTemplate?

    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
    public class TodoService : ITodoService
    {
        private readonly List<Todo> _dataSource;
    
        public TodoService()
        {
            _dataSource = new List<Todo>();
        }
    
        public List<Todo> Todos()
        {
            return _dataSource;
        }
    }
    
    [ServiceContract]
    public interface ITodoService
    {
        [WebGet(UriTemplate = "Todos")]
        [OperationContract]        
        List<Todo> Todos();
    }
    

    If you’re hosting in IIS, what does your TaskService.svc file look like?

    EDIT: Oh, this IS your .svc file. Never mind then.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Consider the code below (which has been simplified). I have a service class that
I am trying to fetch wcf service from jquery. I have written below code
I have written a very simple WCF service, that worked fine (code below), then
I have a WCF service and methods are exposed as below: public interface IService
I currently have service classes that look something like this public class UserService :
I have the below code for returning back an instance of my WCF Service
I have a table withe different columns as shown below Ref Number Service Numbers
i want disable statusbar in activity, i have use below code, it happen SecurityException,
I have the following code, which connects to a web service and returns an
I have the code below which I now need to figure out how to

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.