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();
}
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();
}