Dot net web service problem

vbimport

#1

I am having a problem with a consumer (ASPX) accessing a dot net web service.

On Server “A” I have deployed both the consumer (ASPX) and the web service. The web service works perfectly fine with:

  1. A consumer on any other machine
  2. In the browser
  3. Using an ASP or ASPX client on server A itself or any other machine

However if the ASPX file deployed on Server A tries to access the web service on Server A or ANY other server, it fails with the following error:

The underlying connection was closed: Unable to connect to the remote server.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Net.WebException: The underlying connection was closed: Unable to connect to the remote server.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[WebException: The underlying connection was closed: Unable to connect to the remote server.]
System.Net.HttpWebRequest.CheckFinalStatus() +677
System.Net.HttpWebRequest.EndGetRequestStream(IAsyncResult asyncResult) +75
System.Net.HttpWebRequest.GetRequestStream() +234
System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters) +105
AHM.R.BRG.BOXIConsumer.BrgProxyXiService.BoXiUtilityService.GetReport(String boReportIdentifier, Object[] promptNames, Object[] promptValues, String sessionId, ReportRetrievalMode retrievalMode, ReportFormat reportFormat) in C:\Inetpub\wwwroot\AHM.R.BRG.BOXIConsumer\Web References\BrgProxyXiService\Reference.vb:48
AHM.R.BRG.BOXIConsumer.BrgBoXiConsumer.Page_Load(Object sender, EventArgs e) in C:\Inetpub\wwwroot\AHM.R.BRG.BOXIConsumer\RQXA_ViewReport.aspx.vb:168
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +750

Server details: Windows 2003 server, IIS 6.0, Dot net framework 1.1 SP1 installed

Any help would be appreciated.


#2

Never mind, I solved the problem by adding this to the Reference.vb file


Protected Overrides Function GetWebRequest(ByVal uri As System.Uri) As System.Net.WebRequest

     Dim w As HttpWebRequest = DirectCast(MyBase.GetWebRequest(uri), HttpWebRequest)

     w.ProtocolVersion = HttpVersion.Version10

     w.KeepAlive = False

     Return w

   End Function