Click here to Skip to main content
11,798,866 members (46,519 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: C# ASP.NET .NET WCF .NET4
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
Edited 26-Sep-12 20:40pm
BobJanova at 27-Sep-12 5:10am
Perhaps you used to have it defined as POST and haven't updated the client?
Code0987 at 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 at 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 at 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 at 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 at 27-Sep-12 10:57am
I'm not using service reference. I'm using WebChannelFactory factory.
BobJanova at 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
0 CPallini 465
1 OriginalGriff 378
2 Maciej Los 305
3 Richard MacCutchan 281
4 phil.o 244
0 OriginalGriff 2,270
1 Maciej Los 1,810
2 KrunalRohit 1,496
3 CPallini 1,425
4 Richard MacCutchan 1,109

Advertise | Privacy | Mobile
Web02 | 2.8.151002.1 | Last Updated 27 Sep 2012
Copyright © CodeProject, 1999-2015
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