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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T09:15:12+00:00 2026-05-26T09:15:12+00:00

this post is off the back of my last question (thought i’d start a

  • 0

this post is off the back of my last question (thought i’d start a new question).

i am trying to create and test a simple (simple to you not me lol) WCF web service that outputs JSON. I beleive (with help) the application is ok but i need to test it and i a not sure how.

I’ll attach my code below but here is what is happening, if i run the application it loads http://localhost:52002/ and i get the welcome to ASP.NET page, if run the application while i am in my .svc it loads http://localhost:52002/MyTestService.svc and i get the page:

You have created a service.

To test this service, you will need to create a client and use it to
call the service. You can do this using the svcutil.exe tool from the
command line with the following syntax:

svcutil.exe http://localhost:52002/MyTestService.svc?wsdl

I have been told i can http://localhost:52002/MyTestService.svc/GetResults to see the JSON output (see code below) but all i get is:

The webpage cannot be found

Any suggestions would be great, i apologies now for being abit new to all this and please ask you to maybe spell things out abit more then you normally would lol

Here is my code and tanks very much

Person.cs

[DataContract]
public class Person
{
    [DataMember]
    public string FirstName { get; set; }

    [DataMember]
    public string LastName { get; set; }

    [DataMember]
    public int Age { get; set; }

    public Person(string firstName, string lastName, int age)
    {
        this.FirstName = firstName;
        this.LastName = lastName;
        this.Age = age;
    }
}

MyTestServices.svc.cs

[ServiceContract(Namespace = "")]
    [AspNetCompatibilityRequirements(RequirementsMode =  `AspNetCompatibilityRequirementsMode.Allowed)]`
    public class TestService
    {
    [OperationContract]
    [WebGet(ResponseFormat = WebMessageFormat.Json)]

    public List<Person> GetResults()
    {
        List<Person> results = new List<Person>();
        results.Add(new Person("Peyton", "Manning", 35));
        results.Add(new Person("Drew", "Brees", 31));
        results.Add(new Person("Tony", "Romo", 29));

        return results;
    }

MyTestService.svc

<%@ ServiceHost Language="C#"
    Service="TestService.TestService"
    Factory="System.ServiceModel.Activation.ServiceHostFactory" %>

Web.Config

<configuration>
  <connectionStrings>
    <add name="ApplicationServices"
         connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true"
         providerName="System.Data.SqlClient" />
  </connectionStrings>

  <system.web>
    <compilation debug="true" targetFramework="4.0" />

    <authentication mode="Forms">
      <forms loginUrl="~/Account/Login.aspx" timeout="2880" />
    </authentication>

    <membership>
      <providers>
        <clear/>
        <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices"
             enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false"
             maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10"
             applicationName="/" />
      </providers>
    </membership>

    <profile>
      <providers>
        <clear/>
        <add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/"/>
      </providers>
    </profile>

    <roleManager enabled="false">
      <providers>
        <clear/>
        <add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="ApplicationServices" applicationName="/" />
        <add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationName="/" />
      </providers>
    </roleManager>

  </system.web>

  <system.webServer>
     <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>
  <system.serviceModel>
    <bindings />
    <client />
    <behaviors>
      <serviceBehaviors>
        <behavior name="">
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="false" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
</configuration>
  • 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-26T09:15:13+00:00Added an answer on May 26, 2026 at 9:15 am

    I am not a WCF expert, so I cannot tell you what is wrong with your current application, but I can give you instructions for setting up a very simple example using your code, which will return a result in Fiddler.

    1. Create a new ASP.NET Empty Web Application
    2. Add a code file with the following:

    Normally I wouldn’t put everything in one file, but for simplicity…

    using System.Collections.Generic;
    using System.Runtime.Serialization;
    using System.ServiceModel;
    using System.ServiceModel.Web;
    
    namespace WebApplication1
    {
        [ServiceContract]
        public interface ITestService
        {
            [OperationContract]
            [WebGet(ResponseFormat = WebMessageFormat.Json)]
            List<Person> GetResults();
        }
    
        public class TestService : ITestService
        {
            public List<Person> GetResults()
            {
                List<Person> results = new List<Person>();
                results.Add(new Person("Peyton", "Manning", 35));
                results.Add(new Person("Drew", "Brees", 31));
                results.Add(new Person("Tony", "Romo", 29));
    
                return results;
            }
        }
    
        [DataContract]
        public class Person
        {
            [DataMember]
            public string FirstName { get; set; }
    
            [DataMember]
            public string LastName { get; set; }
    
            [DataMember]
            public int Age { get; set; }
    
            public Person(string firstName, string lastName, int age)
            {
                this.FirstName = firstName;
                this.LastName = lastName;
                this.Age = age;
            }
        }
    }
    

    Update the web.config file:

    <configuration>
    
        <system.web>
            <compilation debug="true" targetFramework="4.0" />
        </system.web>
    
        <system.serviceModel>
    
            <serviceHostingEnvironment>
                <serviceActivations>
                    <add relativeAddress="test.svc"
                         service="WebApplication1.TestService"
                         factory="System.ServiceModel.Activation.WebServiceHostFactory" />
                </serviceActivations>
            </serviceHostingEnvironment>
    
        </system.serviceModel>
    
    </configuration>
    

    You don’t need a .svc file, so start the application, making note of the root url used by the ASP.NET Development Server. On the Request Builder tab of fiddler enter your url:

    enter image description here

    Click the Execute button and you should see your service results:

    enter image description here

    Hopefully you can use this to figure out what you need to update on your service to get it running. Good luck!

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

Sidebar

Related Questions

This post asks this question but doesn't really give an answer, so I thought
This post is incorrectly tagged 'send' since I cannot create new tags. I have
Ok... First off, I know this isn't a new question. But, for some reason
To piggy back off this post jQuery change the select box value based on
Not sure if this is the correct site to post this question on. When
This question is to piggy back off of a previous one I asked yesterday
First off, I'd love to post some real code for this question, but I
I found this post on Crystal Reports Cutting Off Text in PDF , but
Im writing a form to post data off to paypal, and this works fine,
First off I would like to say that this is my first post and

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.