假设我定义了简单的 WCF 服务
[OperationContract, WebInvoke(Method = "GET", UriTemplate = "*")]
string TestMe ()
和简单的 http 模块来重写 url
context.BeginRequest += (s,e)=>{
var ctx = HttpContext.Current;
var method = ctx.Request.AppRelativeCurrentExecutionFilePath.RemoveFirst("~/");
var args = ctx.Request.QueryString.ToString();
ctx.RewritePath("~/MyService.svc", method, args, false);
}
所以每次调用方法都会被翻译成带参数的TestMe方法
现在我想在这里发布整个请求,
[OperationContract, WebInvoke(Method = "POST", UriTemplate = "*")]
string TestMe (Stream request)
对于这个调用 RewritePath 没有传递服务请求者发布的流,我无法找到解决它的方法。如何重写 url 并保持原始请求字节数组被传输?