Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VB.NET
"Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host"
 
I am getting the above error in my desktop application when i call to webservice.
i ahve one method in webservice which searches the virtual path on server. when i call to this method , i have got the aboove error. I have checked the same path on my server and it is properly working
 
Webservice :-
 
<WebMethod(Description:="Retrieve an array of files with name, attributes and content.")> _
Public Function Browse(ByVal VirtualPath As String, ByVal FileExtension As FileExtensions) As FileInformation()
       Dim i As Integer
       Dim fi As FileInfo
       Dim aFiles As FileInformation()
       Dim mExtension As String
       Select Case FileExtension
           Case FileExtensions.asp
               mExtension = "asp"
           Case FileExtensions.aspx
               mExtension = "aspx"
           Case FileExtensions.gif
               mExtension = "gif"
           Case FileExtensions.htm
               mExtension = "htm"
           Case FileExtensions.html
               mExtension = "html"
           Case FileExtensions.jpg
               mExtension = "jpg"
           Case FileExtensions.dll
               mExtension = "dll"
           Case FileExtensions.exe
               mExtension = "exe"
           Case FileExtensions.all
               mExtension = "*"
       End Select
       Dim di As New DirectoryInfo(WebServerPath & VirtualPath)
       Dim afi As FileInfo() = _
        di.GetFiles("*." & mExtension)
       ReDim Preserve aFiles(afi.Length - 1)
       For Each fi In afi
           aFiles(i) = New FileInformation()
           aFiles(i).Name = fi.Name
           aFiles(i).Size = fi.Length
           aFiles(i).LastAccess = fi.LastAccessTime
           aFiles(i).CreadedDate = fi.CreationTime
           aFiles(i).LastModified = fi.LastWriteTime
           aFiles(i).FileType = fi.Extension
           aFiles(i).FileLocation = fi.DirectoryName
           aFiles(i).FileContent = ReadFile(WebServerPath & VirtualPath & "\" & fi.Name)
           i += 1
       Next
       Return aFiles
   End Function
 
in web.config of webservice:-
 
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
        <add key="WebServerRootPath" value="c:\inetpub\wwwroot\" />
    </appSettings>
</configuration>
 

In my desktop application :-
 
'webreference name :- WSFileSever
'webservice name :- FileServer
'Webmethod :- Browse

mWSFileServer = New WSFileSever.FileServer()
 
 mFileInformation = mWSFileServer.Browse("microt/MicroLNTS.net/Common/NewCarmsDownloads/MicroCramsLNTSWin7HomePre64bit", WSFileSever.FileExtensions.all)
 
Please help me its urgent
Posted 11-Jul-12 20:41pm
Comments
bluesathish at 25-Jul-12 6:36am
   
Post your web.config entries, Let me check. This error may be occured due to the binding settings.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 535
1 OriginalGriff 275
2 Shweta N Mishra 244
3 BillWoodruff 235
4 Deepu S Nair 230
0 OriginalGriff 6,168
1 Sergey Alexandrovich Kryukov 5,818
2 DamithSL 4,958
3 Manas Bhardwaj 4,539
4 Maciej Los 3,755


Advertise | Privacy | Mobile
Web01 | 2.8.1411019.1 | Last Updated 12 Jul 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100