我正在尝试从.NET客户端应用程序调用Web服务(用java编写)。我在循环中调用这个Web服务,每次调用它都会返回数据包。我用小提琴手监控流量。
当我使用http连接时,一切正常。当我尝试通过https连接时,会出现此问题。第一次调用Web服务返回正确的数据(我在fiddler中有3个请求:制作隧道,询问证书,调用web服务方法)。在第二次调用期间(fiddler中只有一个条目:调用web服务方法)我只收到部分响应,这些响应无法解释为有效的xml(因为缺少标记)。我也接受了
Exception:
An error (Unable to read data from the transport connection: The connection was closed.) occurred while transmitting data over the HTTP channel.
我配置了http绑定,但它不能由超时引起:
<binding name="bdContractorHttpBinding_SSL" openTimeout="00:05:00" closeTimeout="00:05:00" receiveTimeout="00:10:00" sendTimeout="00:05:00" maxReceivedMessageSize="10485760" >
<security mode="Transport">
<transport clientCredentialType="Basic"/>
</security>
</binding>
你知道可能导致这些问题的原因吗?
编辑:这是我在button_click事件中输入的代码:
MyService.RequestHeader requestHeader = new MyService.RequestHeader();
MyService.ResponseHeader responseHeader = null;
MyService.GetDataRequest request = new MyService.GetDataRequest();
MyService.GetDataResponset response = null;
requestHeader.RequestID = Guid.NewGuid().ToString();
requestHeader.Timestamp = DateTime.Now;
request.Start = start;
request.Count = count;
MyService.ServiceClient service = null;
using (service = new MyService.ServiceClient("SSL_Endpoint")
{
service.ClientCredentials.UserName.UserName = "xxx";
service.ClientCredentials.UserName.Password = "xxx";
service.Open();
responseHeader = service.GetData(requestHeader, request, out response);
start += count;
service.Close();
}