我是WCF新手。 我的问题是如何将长JSON(这里我将数据表转换为JSON字符串)字符串作为WCF方法的参数?Wcf post方法与长json字符串参数
这里是我的代码:
[OperationContract] [WebInvoke(Method = "GET",ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.WrappedRequest, UriTemplate = "initiateConnection/{jsonData}/{sessionId}")]
void testMethod(string jsonData, string sessionId);
public void testMethod(string jsonData, String sessionId) { }
当我打电话testMethod
与jsonData
串很长,它显示
无效的URI:URI字符串太长
所以在这种情况下,我应该使用POST方法传递JSON结果吗?如果是,那么如何通过它?
如果你提到的post方法,我想你没有在WCF中使用SOAP,对吧?如果您需要REST,请考虑使用WebApi? – Giedrius
@amarb:您可以编辑您的问题以包含该信息。 –