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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T21:21:34+00:00 2026-06-01T21:21:34+00:00

I have a service that is hosted via WebServiceHost and I need to delegate

  • 0

I have a service that is hosted via WebServiceHost and I need to delegate some of the calls to other REST services on the web.

I built a ClientBase concrete class to handle this. The flow looks like this:

http://localhost:8000/users/my@email.com -> My WebServiceHost instance -> ClientBase -> REST service

Everything was working well, until I realized that ALL calls coming from ClientBase were using POST as the verb. In order to make sure I wasn’t doing anything silly with ClientBase I built a ChannelFactory manually and used that. No luck, every call still used POST regardless of ClientBase, ChannelFactory, and even ServiceContract decorations.

I then started isolating code and realized my simple ChannelFactory worked when the original call wasn’t coming from within a request my WebServiceHost was handling.

Here’s a distilled Program.cs that exhibits the exact problem, the MakeGetCall() from Program.Main works as intended, but the call from MyService.GetUser will always POST:

class Program
{
    static void Main(string[] args)
    {
        //Program.MakeGetCall(); //This works as intended even when changing the WebInvoke attribute parameters

        WebServiceHost webServiceHost = new WebServiceHost(typeof(MyService), new Uri("http://localhost:8000/"));

        ServiceEndpoint serviceEndpoint = webServiceHost.AddServiceEndpoint(typeof(IMyServiceContract), new WebHttpBinding(), "");

        webServiceHost.Open();

        Console.ReadLine();
    }

    public static void MakeGetCall()
    {
        ServiceEndpoint endpoint = new ServiceEndpoint(
            ContractDescription.GetContract(typeof(IMyServiceContract)),
            new WebHttpBinding(),
            new EndpointAddress("http://posttestserver.com/post.php"));

        endpoint.Behaviors.Add(new WebHttpBehavior());

        ChannelFactory<IMyServiceContract> cf = new ChannelFactory<IMyServiceContract>(endpoint);

        IMyServiceContract test = cf.CreateChannel();

        test.GetUser("test");
    }

}

[ServiceContract]
public interface IMyServiceContract
{
    [OperationContract]
    [WebInvoke(Method = "GET", ResponseFormat = WebMessageFormat.Json,
        UriTemplate = "/users/{emailAddress}")]
    string GetUser(string emailAddress);
}

public class MyService : IMyServiceContract
{
    public string GetUser(string emailAddress)
    {
        Program.MakeGetCall(); //This will ALWAYS POST no matter if you are using [WebInvoke(Method="GET")] or even [WebGet]

        return "foo";
    }
}
  • 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-01T21:21:36+00:00Added an answer on June 1, 2026 at 9:21 pm

    Found a work around here:

    http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/03a2b109-c400-49d4-891e-03871ae0d083/

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

Sidebar

Related Questions

I have a WCF REST web service that is hosted via a service route
I have a WCF service that is hosted via IIS on multiple web servers.
I have a Web Service hosted on Azure, that is secured under SSL via
I have a piece of code that calls a WCF service that is hosted
I have a web service that serves widgets. It is hosted on a server
I have an existing Java client that I need to build a web service
I have a wcf service that is hosted in IIS. This service launches some
I have a web service that is hosted in a clustered environment. The web
I have WCF service that is hosted in IIS . I need to initialize
I have a web service that is being hosted in SharePoint. The WebService is

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.