【发布时间】:2017-05-10 07:20:45
【问题描述】:
我正在使用带有自定义绑定的 WCF 服务,我设置了 gzip 以减少结果的长度。最近我们迁移到 .NET Core,在我在核心项目中调用我的方法后,我得到了这个错误
接收到
http://www.???.com:96/TicketCache.svc/mex的 HTTP 响应时出错。这可能是由于服务端点绑定未使用 HTTP 协议。这也可能是由于服务器中止了 HTTP 请求上下文(可能是由于服务关闭)。有关详细信息,请参阅服务器日志。
我在 wcf 中更改了我的配置并将其设置为基本绑定后,它工作正常
我搜索了很多并测试了不同的方式,但我无法回答
BinaryMessageEncodingBindingElement binaryMessageEncodingBindingElement = new BinaryMessageEncodingBindingElement();
binaryMessageEncodingBindingElement.CompressionFormat = CompressionFormat.GZip;
HttpTransportBindingElement httpTransportBindingElement = new HttpTransportBindingElement();
httpTransportBindingElement.MaxReceivedMessageSize = 65536000;
httpTransportBindingElement.MaxBufferSize = 65536000;
CustomBinding customBinding = null;
customBinding = new CustomBinding( new BindingElement[] { binaryMessageEncodingBindingElement, httpTransportBindingElement });
customBinding.OpenTimeout = TimeSpan.FromMinutes(10);
customBinding.CloseTimeout = TimeSpan.FromMinutes(10);
customBinding.ReceiveTimeout = TimeSpan.FromMinutes(20);
customBinding.SendTimeout = TimeSpan.FromMinutes(10);
customBinding.CreateBindingElements();
var factory = new ChannelFactory<customBinding, new EndpointAddress("http://www.???.com:96/TicketCache.svc/mex"));
我该如何解决这个问题?
【问题讨论】:
-
服务是否启动并运行,是否授予防火墙访问权限?
-
我允许防火墙中的服务并打开它