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!
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…