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

  • Home
  • SEARCH
  • 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 621157
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T18:50:38+00:00 2026-05-13T18:50:38+00:00

I am specifically looking for an example which use a) WCF & REST. After

  • 0

I am specifically looking for an example which use a) WCF & REST. After a long googling, though I got some but they are beyond my understanding.

Could some one please give me a very simple example say “Hallow World” or Summation of 2 numbers which will give me a clear insight about how to write a server, and also how to consume the same from the client end.

Also if any good link that explains this kind of example in simple terms kindly tell me that.

Thanks

  • 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-13T18:50:38+00:00Added an answer on May 13, 2026 at 6:50 pm

    REST in WCF is not that hard once you figure it out.

    First you must define your interface.

    Here is an example.

    [ServiceContract]
    public interface IRESTExample
    {
        [WebGet(UriTemplate = "interaction/queue?s={site}", RequestFormat = WebMessageFormat.Xml, ResponseFormat = WebMessageFormat.Xml)]
        [OperationContract]
        string QueueInteraction(string site);
    
        [WebGet(UriTemplate = "interaction/cancel?id={interactionId}", RequestFormat = WebMessageFormat.Xml, ResponseFormat = WebMessageFormat.Xml)]
        [OperationContract]
        string CancelInteraction(string interactionId);
    
        [WebGet(UriTemplate = "queue/state?s={site}&q={queue}", RequestFormat = WebMessageFormat.Xml, ResponseFormat = WebMessageFormat.Xml)]
        [OperationContract]
        string QueueState(string site, string queue);
    
    }
    

    You can see in the WebGet you define the final URL. So it depends on where you bind it, but say you bind the endpoint to http://www.example.com/rest

    QueueInteraciton would be http://www.example.com/rest/interaction/queue?s=SomeSite

    Where {stie} or {parameterName} is replaced with the name of the parameter.

    The implemetion is just a simple class, I am going to assume you know how to implement an interface. If you need help just leave a comment.

    Now binding the endpoint. In the end it is not that hard, you can do it all in the config.

    <system.serviceModel>
        <services>
            <service name="Stackoverflow.Example.Service.RestExample" behaviorConfiguration="MyServiceTypeBehaviors">
                <host>
                    <baseAddresses>
                        <add baseAddress="http://localhost:2136/RestExample"/>
                    </baseAddresses>
                </host>
    
                <endpoint address="rest" binding="webHttpBinding" behaviorConfiguration="xmlBehavior" contract="Stackoverflow.Example.Service.IRESTExample" />
    
            </service>
        </services>
        <behaviors>
            <serviceBehaviors>
                <behavior name="MyServiceTypeBehaviors" >
                    <!-- Add the following element to your service behavior configuration. -->
                    <serviceMetadata httpGetEnabled="true" />
                </behavior>
            </serviceBehaviors>
    
            <endpointBehaviors>
                <behavior name="jsonBehavior">
                    <webHttp/>
                </behavior>
                <behavior name="xmlBehavior">
                    <webHttp/>
                </behavior>
            </endpointBehaviors>
        </behaviors>
        <bindings>
            <basicHttpBinding>
                <binding name = "NoSecurity">
                    <security mode = "None" />
                </binding>
            </basicHttpBinding>
        </bindings>
    </system.serviceModel>
    

    Now the code to start the service and bind it. YOu can do it in anything, for example a console app.

    RestExample exampleService = new RestExample();
    
    host = new ServiceHost(exampleService);
    
    host.Open();
    

    This should be enough to get started.

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

Sidebar

Ask A Question

Stats

  • Questions 347k
  • Answers 347k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer After many long hours of debugging a similar issue I… May 14, 2026 at 6:26 am
  • Editorial Team
    Editorial Team added an answer What about a static method on the class to handle… May 14, 2026 at 6:26 am
  • Editorial Team
    Editorial Team added an answer I do not understand why you want to use a… May 14, 2026 at 6:26 am

Related Questions

When validating user inputs in an application that is to be run across multiple
I have a completely blank .aspx file residing on an IIS6 web server. The
I am working in a Microsoft .NET shop where it is okay to use
This question covers a broad range of programming languages; however, I am specifically working
We are developing an application that would be offered as a hosted solution. I

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.