Async web service problem

E

Emre Aydinceren

When trying to following code in responsive network there
is no problem but, if I take the client out of intranet (
relatively lower latency situation) I got this exception
message. Please help!

************** Exception Text **************

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

at System.Net.HttpWebRequest.CheckFinalStatus()

at System.Net.HttpWebRequest.EndGetRequestStream
(IAsyncResult asyncResult)

at System.Net.HttpWebRequest.GetRequestStream()

at
System.Web.Services.Protocols.SoapHttpClientProtocol.Invok
e(String methodName, Object[] parameters)

at
Code.Windows.Controls.ImagingWS.CatalogEditingImagingServi
ce.GetImage(Int32 ImageID)

at Code.Windows.Controls.ImageExplorer.OpenImage(Int32
ImageID)

at Code.Windows.Controls.ImageExplorer.pictureBox_Click
(Object sender, EventArgs e)

at System.Windows.Forms.Control.OnClick(EventArgs e)

at System.Windows.Forms.Control.WmMouseUp(Message& m,
MouseButtons button, Int32 clicks)

at System.Windows.Forms.Control.WndProc(Message& m)

at System.Windows.Forms.ControlNativeWindow.OnMessage
(Message& m)

at System.Windows.Forms.ControlNativeWindow.WndProc
(Message& m)

at System.Windows.Forms.NativeWindow.Callback(IntPtr
hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)



*************************************

private void DownloadNextPicture()
{

AsyncCallback cb = new
AsyncCallback(ImageDownloaded);
int ImageID;
LastDownloadedPicuteBoxIndex++;
if
(_ShowMultipleImages)
{
ImageID=(int)
PictureBoxArray[LastDownloadedPicuteBoxIndex].Tag;
}
else
{
ImageID=_selectedimageid;
}

ImagingWS.BeginGetThumbnail
(ImageID,PictureWidth,cb,ImagingWS);
}

private void ImageDownloaded(IAsyncResult
ar)
{

Code.Windows.Controls.ImagingWS.CatalogEditingImag
ingService ImageService2 =
(Code.Windows.Controls.ImagingWS.CatalogEditingImagingServ
ice)ar.AsyncState;
byte[] bytearray;
// Retrieve results by calling
the End method of the proxy class
try
{
bytearray =
ImageService2.EndGetThumbnail(ar);
}
catch
{
return;
}

if(bytearray==null) return;

MemoryStream stmBLOBData = new
MemoryStream(bytearray);


PictureBoxArray[LastDownloadedPicuteBoxIndex].Image =
Image.FromStream(stmBLOBData);

if(LastDownloadedPicuteBoxIndex==thedatatable.Rows.Count -
1)
{
LastDownloadedPicuteBoxIndex=-1;
return;
}
if(!stopflag)
DownloadNextPicture();


}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top