atu*_*rch 2 c# wcf soap web-services
我正在使用带有SOAP消息体系结构的WCF。我的服务使用BasicHttpBinding来传输我的SOAP消息。我需要向HTTP响应中添加2个不同的HTTP标头(来源和缓存控件)。我知道在启用aspNetCompatibilityEnabled的情况下可以在Global.asax文件中执行此操作,但是存在一个问题-我正在使用Windows服务托管WCF。aspNetCompatibilityEnabled仅在IIS下有效。有人可以帮助我解决问题吗?
我相信这篇文章是关于您想做什么的:这里。您可以执行以下操作:
var context = WebOperationContext.Current;
HttpResponseHeader cacheHeader = HttpResponseHeader.CacheControl;
String cacheControlValue = String.Format("max-age={0}, must-revalidate", maxCacheAge);
context.OutgoingResponse.Headers.Add(cacheHeader, cacheControlValue);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5518 次 |
| 最近记录: |