&引用;连接:关闭“;在WCF中(Windows应用商店应用程序)

&引用;连接:关闭“;在WCF中(Windows应用商店应用程序),wcf,windows-8,Wcf,Windows 8,我在Windows应用商店应用程序中编写了以下程序 CustomBinding b = new CustomBinding() ; TextMessageEncodingBindingElement t = new TextMessageEncodingBindingElement(); HttpTransportBindingElement h = new HttpTransportBindingElement(); b.Elements.Add(t); b.Element

我在Windows应用商店应用程序中编写了以下程序

CustomBinding b = new CustomBinding() ;
TextMessageEncodingBindingElement t = new TextMessageEncodingBindingElement();
HttpTransportBindingElement h = new HttpTransportBindingElement();          
b.Elements.Add(t);
b.Elements.Add(h);

MyService client = new MyService(b, new EndpointAddress("http://localhost:8080/"));

var request = ...;
var response = client.Service000(request);
h.KeepAliveEnabled = false;
我想在HTTP头中设置
Connection:Close
。 但以下代码在Windows应用商店应用程序中出现错误

CustomBinding b = new CustomBinding() ;
TextMessageEncodingBindingElement t = new TextMessageEncodingBindingElement();
HttpTransportBindingElement h = new HttpTransportBindingElement();          
b.Elements.Add(t);
b.Elements.Add(h);

MyService client = new MyService(b, new EndpointAddress("http://localhost:8080/"));

var request = ...;
var response = client.Service000(request);
h.KeepAliveEnabled = false;
我试图在MessageInspector中添加一个自定义HTTP头,但它也不起作用。 有没有办法在HTTP头中设置
连接:Close