Web Service 基础连接已经关闭的解决方案
首先将引用该WebServices的程序在IDE中打开;
然后在“解决方案资源管理器”中展开“web reference”——“webservices 名”——“Reference.map”——“Reference.cs(.vb)”;
cs文件中添加如下代码:
然后在“解决方案资源管理器”中展开“web reference”——“webservices 名”——“Reference.map”——“Reference.cs(.vb)”;
cs文件中添加如下代码:
using System.Net;
protected override WebRequest GetWebRequest( Uri uri)
{
HttpWebRequest webRequest = ( HttpWebRequest)base.GetWebRequest(uri);
webRequest.KeepAlive = false;
webRequest.ProtocolVersion = HttpVersion.Version10;
return webRequest;
}
protected override WebRequest GetWebRequest( Uri uri)
{
HttpWebRequest webRequest = ( HttpWebRequest)base.GetWebRequest(uri);
webRequest.KeepAlive = false;
webRequest.ProtocolVersion = HttpVersion.Version10;
return webRequest;
}