httpwebrequest asynchronous calls work on one server but not on another

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sindhurasingeetham
    New Member
    • Jul 2008
    • 2

    httpwebrequest asynchronous calls work on one server but not on another

    Hi,

    I'm new to coding in .NET. I am trying to do an asynchronous call in my code using httpwebrequest. This code works perfectly fine on one server, but does not work on another. The main flow works on the new server, but it somehow does not do the asynchronous calling part. I'm unable to see the async part hitting IIS (from the IIS logs) as well. I have compared the IIS settings on both the servers and they are the same. The settings on both servers are such that the ASP page being called accepts POST requests. Could someone please suggest if I'm missing something here?

    Here is the relevant extract from my code:

    Code:
    ' Removed some appln specific code
    Imports System.Text
    Imports System.IO
    Imports System.Net
    Imports System.Threading
    Imports Microsoft
    ' Removed some appln specific code
    
    Public Class clsAppmtCleanUp
    
    ' Removed some appln specific code
    
        Public Sub Schedule_PH(ByRef objSXP As Telstra.Connect.DataLayer.clsDataLayerComponent, _
                               ByVal strConnectID As String, _
                               ByRef objCodeDBCP As CodesDBCPLib.ILookup, _
                               ByRef objErr As ConnectEventDetails)
    
    ' Removed some appln specific code
    
        Dim request As HttpWebRequest
        Dim result As IAsyncResult
    
    ' Removed some appln specific code
    
        Try
                ' Set web request properties
                strURL = 'http://localhost/INT/W6PIncomingProcessor.asp'
                request = CType(WebRequest.Create(strURL), HttpWebRequest)
                request.Credentials = System.Net.CredentialCache.DefaultCredentials
                request.ContentType = "application/x-www-form-urlencoded"
                request.Method = "POST"
    
                result = CType(request.BeginGetRequestStream(AddressOf RequestComplete, request), IAsyncResult)
                'T0 Execute the Schedule_PH as one thread and RequestComplete as Different Thread
                objAllDone.WaitOne()
    
            End If
    
        Catch ex As Exception
        Finally
    
    ' Removed some appln specific code
    	
    	request = Nothing
            result = Nothing
    
        End Try
    
        End Sub
    
        Private Sub RequestComplete(ByVal asynchronousResult As IAsyncResult)
    
        Dim request As HttpWebRequest
        Dim postStream As Stream
        Dim byteArray As Byte()
    
        Try
    
            request = CType(asynchronousResult.AsyncState, HttpWebRequest)
            postStream = request.EndGetRequestStream(asynchronousResult)
            byteArray = Encoding.UTF8.GetBytes(g_strMessage)
            postStream.Write(byteArray, 0, g_strMessage.Length)
            objAllDone.Set()
        Catch ex As Exception
    
        Finally
            postStream.Close()
    
        End Try
    
        End Sub
    
    ' Removed some appln specific code
    
    End Class
    Any suggestions that you can give would be of great help!

    Thanks,
    Sindhura
    Last edited by Curtis Rutland; Jul 28 '08, 12:28 PM. Reason: Added code tags -- Please use the # button
  • sindhurasingeetham
    New Member
    • Jul 2008
    • 2

    #2
    Sorry, forgot to mention.

    Both servers are Windows 2003 servers (SP1) and have IIS6.0 installed.

    Comment

    Working...