[英]error Bad Request in WCF using basichttpBinding with transfermode of streamed
Im Having a problem consuming my WCF service, first i tried to consume my wcf without adding service reference, and i use channelfactory to consume it when i use basichttpbinding and transfermode of buffered it works fine but when i use streamed as transfermode it give error Bad Request 我在使用WCF服务时遇到问题,首先我尝试使用wcf而不添加服务引用,并且当我使用basichttpbinding和缓冲的transfermode时,我使用channelfactory来使用它,效果很好,但是当我使用流式传输作为transfermode时,它给出错误错误请求
Here's where i call my service please take a look thanks in advance 我在这里打电话给我的服务,请提前看看谢谢
public static BasicHttpBinding basicHttpBinding()
{
BasicHttpBinding BasicHttpBinding_IService1 = new BasicHttpBinding();
BasicHttpBinding_IService1.CloseTimeout = TimeSpan.Parse("00:01:00");
BasicHttpBinding_IService1.OpenTimeout = TimeSpan.Parse("00:01:00");
BasicHttpBinding_IService1.ReceiveTimeout = TimeSpan.Parse("00:10:00");
BasicHttpBinding_IService1.SendTimeout = TimeSpan.Parse("00:01:00");
BasicHttpBinding_IService1.AllowCookies = false;
BasicHttpBinding_IService1.BypassProxyOnLocal = false;
BasicHttpBinding_IService1.HostNameComparisonMode = HostNameComparisonMode.StrongWildcard;
BasicHttpBinding_IService1.MaxBufferSize = 2147483646;
BasicHttpBinding_IService1.MaxBufferPoolSize = 524288;
BasicHttpBinding_IService1.MaxReceivedMessageSize = 2147483646;
BasicHttpBinding_IService1.MessageEncoding = WSMessageEncoding.Text;
BasicHttpBinding_IService1.UseDefaultWebProxy = true;
BasicHttpBinding_IService1.TextEncoding = UTF8Encoding.UTF8;
BasicHttpBinding_IService1.TransferMode = TransferMode.Streamed;
return BasicHttpBinding_IService1;
}
public static EndpointAddress endPointAddress()
{
EndpointAddress endpointAddress = new EndpointAddress("http://localhost:5409/IService.svc");
return endpointAddress;
}
private void button1_Click(object sender, EventArgs e)
{
ChannelFactory<IService> myChannelFactory = null;
myChannelFactory = new ChannelFactory<IService>(basicHttpBinding(), endPointAddress());
IService client = myChannelFactory.CreateChannel();
MessageBox.Show(client.GetData(1));
}
The TransferMode
of Streamed
is not supported by the ASP.NET development server. ASP.NET开发服务器不支持Streamed
的TransferMode
。
Use IIS or Self-Host the WCF Service to get around it. 使用IIS或自托管WCF服务即可解决该问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.