How can I pass slash and other 'url sensitive' characters to a WCF REST service?

I solved it.

URI template is the key.

If I define URI this way, it produces the exception above:

[OperationContract()]
[WebGet(UriTemplate = "/testmethod/{testvalue}"/*, BodyStyle = WebMessageBodyStyle.Bare, ResponseFormat = WebMessageFormat.Xml*/)]
string TestMethod(string testvalue);

By modifying this way, it works:

[OperationContract()]
[WebGet(UriTemplate = "/testmethod?v={testvalue}"/*, BodyStyle = WebMessageBodyStyle.Bare, ResponseFormat = WebMessageFormat.Xml*/)]
string TestMethod(string testvalue);

Anyway, Uri.EscapeDataString is needed!