是否可以使用使用HTTP POST的方法在浏览器的地址栏中显示的URI?例如,我有一个OperationContract
定义如下:
[OperationContract, WebInvoke(Method = "POST")]
Stream GetFile(string username, int fileid);
目前,这两个参数都是使用POST发送的。但是,如果我只想通过POST发送“用户名”并在URI中显示“fileid”,该怎么办?以下是否有效?
[OperationContract, WebInvoke(Method = "POST", UriTemplate = "GetFile?fileid={fileid}")]
Stream GetFile(string username, int fileid);
即,我希望GetFile?fileid={fileid}
在访问该服务的浏览器的地址栏中可见。
答案 0 :(得分:1)
似乎它可以工作。当然,HTTP POST请求可以有查询参数。