Click here to Skip to main content
13,195,379 members (65,845 online)
Rate this:
Please Sign up or sign in to vote.
What could be the reason for WCF Service on webHttpBinding on ASP.Net server not getting data from client using WebChannelFactory, only the method is called but parameters are not send to server.


[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class MyService : IMyService
    [WebGet] // Using WebPost causes 405 Errors
    public MyDataType GetMyData(string input) // input is always empty. ?


    WebChannelFactory<IMyService> factory = 
        new WebChannelFactory<IMyService>(
            new WebHttpBinding(WebHttpSecurityMode.TransportCredentialOnly),
            new Uri("")
     factory.Endpoint.Behaviors.Add(new WebHttpBehavior());
     IMyService service = factory.CreateChannel();
     MyDataType my = service.GetMyData("input");                
Posted 26-Sep-12 20:18pm
Updated 26-Sep-12 20:40pm
BobJanova 27-Sep-12 5:10am
Perhaps you used to have it defined as POST and haven't updated the client?
Code0987 27-Sep-12 9:28am
No. Nothing work, i tried all possible things. Well this used to work (and still work in remote server) but not in local server. I've VS12, II8.
BobJanova 27-Sep-12 10:15am
You have obviously not tried 'all possible things', or you'd have tripped over the one that makes it work ;)

There is very little to go on here. You've posted some code that should work. Have you tried looking at the HTTP requests that are actually being made, to see whether the argument is being passed?

Does it work if you change the URL to the remote server and re-run? If so it's something to do with your local server.
Code0987 27-Sep-12 10:52am
This works when I make requests from Chrome or Fiddler but doesn't work with ChannelFactory, it doesn't send argument data. Sometimes 400 and 405 error occur though.
BobJanova 27-Sep-12 10:56am
Then the problem is with the client. Are you -sure- you updated the service reference after you made this a GET method?
Code0987 27-Sep-12 10:57am
I'm not using service reference. I'm using WebChannelFactory<imyservice> factory.
BobJanova 27-Sep-12 11:04am
Oh right, sorry. When you look at the .svc in a browser, is the method defined correctly? Does it look different for the local and remote servers?

This is some form of configuration error and frankly there's no way anyone on here is going to be able to solve it for you.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web04 | 2.8.171019.1 | Last Updated 27 Sep 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100