0

I have a contract:

        [OperationContract]
        [WebGet(ResponseFormat = WebMessageFormat.Json)]
        bool SendEmail(string mailMessage);

I am calling it like this: (very long - Straight out of Chrome debugger)

http://localhost:8093/AnnualReviewService/json/SendEmail?callback=json_Callback0&mailMessage={%22From%22:{%22address%22:%22fake.manager@fooo.com%22},%22To%22:[],%22Bcc%22:[{%22address%22:%22Fake.ProjectManager@Fooo.com%22},{%22address%22:%22Fake.ProjectManager@Fooo.com%22},{%22address%22:%22Fake.ProjectManager@Fooo.com%22},{%22address%22:%22Fake.ProjectManager@Fooo.com%22},{%22address%22:%22Fake.ProjectManager@Fooo.com%22},{%22address%22:%22Fake.ProjectManager@Fooo.com%22},{%22address%22:%22Fake.ProjectManager@Fooo.com%22}],%22CC%22:[],%22Priority%22:2,%22Subject%22:%22Important!%20Peer%20Feedback%20Needed%22,%22Body%22:%22\n\t\t\t%3Cp%3E%3Cb%3EAll,%20%3C/b%3E%3C/p%3E\n\t\t\t\t%3Cp%3E%3Cb%3E %3C/b%3E%3C/p%3E\n\t\t\t\t%3Cp%3E%3Cb%20class=\%22ng-binding\%22%3EI%20am%20reaching%20out%20to%20you%20to%20request%20very%20targeted\n\t\t\t\tfeedback%20for%20Fake%20User.%20You%20have%20been%20chosen%20due%20to%20your%20experience\n\t\t\t\tworking%20with%20this%20person.%20This%20feedback%20is%20kept%20anonymous,%20and%20its%20intent%20is%20to%20not\n\t\t\t\tonly%20point%20out%20the%20areas%20where%20this%20person%20excels,%20but%20to%20also%20offer%20some\n\t\t\t\tconstructive%20feedback.%3C/b%3E%3C/p%3E\n\t\t\t\t%3Cp%3E%3Cb%3E %3C/b%3E%3C/p%3E\n\t\t\t\t%3Cp%3E%3Cb%3EIt%20is%20very%20important%20that%20each%20of%20you%20take%20the%20time%20in\n\t\t\t\tthe%20next%20couple%20of%20days%20to%20provide%20me%20this%20feedback.%3C/b%3E%3C/p%3E\n\t\t\t\t%3Cp%3E%3Cb%3E %3C/b%3E%3C/p%3E\n\t\t\t\t%3Cp%3E%3Cb%3EThank%20you!%3C/b%3E%3C/p%3E\n\t\t\t\t%3Cp%3E %3C/p%3E\n\t\t%20%20%22,%22IsBodyHtml%22:true}

When I debug all I see passed in is this:

"{\"From\":{\"address\":\"Fake.Manager@FOOO.com\"},\"To\":[],\"Bcc\":[{\"address\":\"Fake.ProjectManager@FOOO.com\"},{\"address\":\"Fake.ProjectManager@FOOO.com\"},{\"address\":\"Fake.ProjectManager@FOOO.com\"},{\"address\":\"Fake.ProjectManager@FOOO.com\"},{\"address\":\"Fake.ProjectManager@FOOO.com\"},{\"address\":\"Fake.ProjectManager@FOOO.com\"},{\"address\":\"Fake.ProjectManager@FOOO.com\"},{\"address\":\"Fake.ProjectManager@FOOO.com\"},{\"address\":\"Fake.ProjectManager@FOOO.com\"}],\"CC\":[],\"Priority\":2,\"Subject\":\"Important! Peer Feedback Needed\",\"Body\":\"\\n\\t\\t\\t<p><b>All, </b></p>\\n\\t\\t\\t\\t<p><b>"

Is there some limit to what I can pass in? I havent been able to find anything of significance.

This is .NET 4.5

EDIT If there is a limit can you please provide a link to it being documented

Thank you

Wjdavis5
  • 3,952
  • 7
  • 35
  • 63
  • Your URL is 1629 long, while over the 2048 max of URL's specified by IEEE, it is long enough to be be over some limit in WCF. – Scott Chamberlain Feb 16 '14 at 18:33
  • @ScottChamberlain Thanks for the reply - Could said 'some limit' is this documented anywhere that you know of? – Wjdavis5 Feb 16 '14 at 18:40
  • The only documented limit I could find is [the 2048 limit of URL's in general](http://stackoverflow.com/questions/417142/what-is-the-maximum-length-of-a-url-in-different-browsers). – Scott Chamberlain Feb 16 '14 at 18:43

2 Answers2

0

Since you specify in the title "WCF String Input Length", I wanted to point you to this StackOverflow article:

Add restrictions to WCF in method/data member

(would have added this as a comment, but I am not yet allowed since I just joined.)

Hope this helps!

Community
  • 1
  • 1
Jeff
  • 2,495
  • 18
  • 38
0

This is not a direct answer to your question, but you really should consider making this a POST with the content in the request body using a content type like application/x-www-form-urlencoded. As others have pointed out in the comments there is ultimately a limit to just how much can fit on the URL Also, it seems like this is design as a GET operation right now in terms of HTTP. Technically GETs are supposed to be idempotent and this seems like something that is going to be changing some kind of state on the server.

Drew Marsh
  • 33,111
  • 3
  • 82
  • 100
  • It probably should be a post to get the contents into the body. But there isnt any state change happening. Thanks for the comment! – Wjdavis5 Feb 16 '14 at 20:53
  • Well give that a shot because it may alleviate whatever weird querystring restriction you're running into here. I don't personally know of any options for controlling the parsing of the querystring and the normal WCF configuration options like MaxStringContentLength defaults to 8k, so, unless you've changed that on your webHttpBinding, I don't think that's governing this. – Drew Marsh Feb 17 '14 at 19:42