473,395 Members | 1,466 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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:

Expand|Select|Wrap|Line Numbers
  1. ' Removed some appln specific code
  2. Imports System.Text
  3. Imports System.IO
  4. Imports System.Net
  5. Imports System.Threading
  6. Imports Microsoft
  7. ' Removed some appln specific code
  8.  
  9. Public Class clsAppmtCleanUp
  10.  
  11. ' Removed some appln specific code
  12.  
  13.     Public Sub Schedule_PH(ByRef objSXP As Telstra.Connect.DataLayer.clsDataLayerComponent, _
  14.                            ByVal strConnectID As String, _
  15.                            ByRef objCodeDBCP As CodesDBCPLib.ILookup, _
  16.                            ByRef objErr As ConnectEventDetails)
  17.  
  18. ' Removed some appln specific code
  19.  
  20.     Dim request As HttpWebRequest
  21.     Dim result As IAsyncResult
  22.  
  23. ' Removed some appln specific code
  24.  
  25.     Try
  26.             ' Set web request properties
  27.             strURL = 'http://localhost/INT/W6PIncomingProcessor.asp'
  28.             request = CType(WebRequest.Create(strURL), HttpWebRequest)
  29.             request.Credentials = System.Net.CredentialCache.DefaultCredentials
  30.             request.ContentType = "application/x-www-form-urlencoded"
  31.             request.Method = "POST"
  32.  
  33.             result = CType(request.BeginGetRequestStream(AddressOf RequestComplete, request), IAsyncResult)
  34.             'T0 Execute the Schedule_PH as one thread and RequestComplete as Different Thread
  35.             objAllDone.WaitOne()
  36.  
  37.         End If
  38.  
  39.     Catch ex As Exception
  40.     Finally
  41.  
  42. ' Removed some appln specific code
  43.  
  44.     request = Nothing
  45.         result = Nothing
  46.  
  47.     End Try
  48.  
  49.     End Sub
  50.  
  51.     Private Sub RequestComplete(ByVal asynchronousResult As IAsyncResult)
  52.  
  53.     Dim request As HttpWebRequest
  54.     Dim postStream As Stream
  55.     Dim byteArray As Byte()
  56.  
  57.     Try
  58.  
  59.         request = CType(asynchronousResult.AsyncState, HttpWebRequest)
  60.         postStream = request.EndGetRequestStream(asynchronousResult)
  61.         byteArray = Encoding.UTF8.GetBytes(g_strMessage)
  62.         postStream.Write(byteArray, 0, g_strMessage.Length)
  63.         objAllDone.Set()
  64.     Catch ex As Exception
  65.  
  66.     Finally
  67.         postStream.Close()
  68.  
  69.     End Try
  70.  
  71.     End Sub
  72.  
  73. ' Removed some appln specific code
  74.  
  75. End Class
  76.  
Any suggestions that you can give would be of great help!

Thanks,
Sindhura
Jul 28 '08 #1
1 1870
Sorry, forgot to mention.

Both servers are Windows 2003 servers (SP1) and have IIS6.0 installed.
Jul 28 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

10
by: Gregory A Greenman | last post by:
I'm trying to write a program in vb.net to automate filling out a series of forms on a website. There are three forms I need to fill out in sequence. The first one is urlencoded. My program is...
8
by: TC | last post by:
Hello, I am making an asynchronous call to a webservice and trying to update the web page with the results. The page is not updating. Does anybody know why??? Below is my code:
2
by: Michael | last post by:
Hi all.. I need to submit an asynchronous request for a credit card authorization. I have an aspx page where the user confirms the transaction and clicks a button to send the transaction to the...
1
by: Sojwal Chitnis | last post by:
Hi, We have a asp.net web application in which we are making HTTP requests to a remote web server (CGI) & get response in form of XML data. We are using HttpWebRequest object to post the...
1
by: sfoxover | last post by:
Hi, Could someone please give me some suggestions on how to make this class robust. I need to be able to handle around 20 similtanious requests to this class which causes a web browser to...
1
by: Assaf Shemesh | last post by:
Hi, I'm having a problem with asynchronous HttpWebRequest. It's a simple http client-server. For most of my users it works fine. However, some of them get the exception: ...
7
by: Siv | last post by:
Hi, I have a stored procedure that I want to execute and then wait in a loop showing a timer whilst it completes and then carry on once I get notification that it has completed. The main reason...
1
by: dba123 | last post by:
I need to perform Asynchronous Inserts using DAAB. So far I have a method which does an insert but how can I do this Asyncronously so that it does not affect the load on our public production...
7
by: Marc Bartsch | last post by:
Hi, I have a background worker in my C# app that makes a synchronous HttpWebRequest.GetResponse() call. The idea is to POST a file to a server on the internet. When I call HttpWebRequest.Abort()...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.