File Download win2003 server

  • Thread starter Thread starter Harry Simpson
  • Start date Start date
H

Harry Simpson

I'm using Http to pull a file from a directory in a web sevice down to the
device. Works like a champ here in the office between my XP Pro laptop (web
service on it) and my dev box. But keep erring out when deployed at the
client's site.

I'm thinking their may be firewall or services shut down on the server
keeping me from downloading files to the device. The client server is
Windows 2003 Server.

Any ideas on what I could try?

Harry
 
Can you access this web service via Internet Explorer using your regular
computer?
 
I am having similar problem.
I have developed web service, which is called by my application for checking
updates. If update is found then path of the related cab file is returned to
application. In application, I am programmatically downloading files on
Pocket PC by following code.

This code works fine when I configure my web service locally (local IIS). I
am able to download cab file but in case of live address this code gives
“HTTP 403 forbidden†error.

When I try to open the same cab file from pocket pc’s IE then it can be
downloaded via IE on Pocket PC, but when I try to download it
programmatically it gives error.

'Used for creating Request.
Dim LOC_Req As HttpWebRequest
Dim LOC_Resp As HttpWebResponse

' Retrieve response stream
Dim LOC_RespStream As Stream
'Used Create local cab file
Dim LOC_Wrtr As FileStream
Dim LOC_BytesRead As Integer = 0
' Allocate byte buffer to hold stream contents
Dim LOC_InData(4095) As Byte
Try
'Creating request
LOC_Req = CType(WebRequest.Create(DownloadUrl), HttpWebRequest)
'Set http-request's method to "GET"
LOC_Req.Method = "GET"
'Get Response.
LOC_Resp = CType(LOC_Req.GetResponse(), HttpWebResponse)
'Check if available space on device is less than or equal to
size of cab file.
'Get Response's stream.
LOC_RespStream = LOC_Resp.GetResponseStream()
'Create a file.
LOC_Wrtr = New FileStream(LocalFile, FileMode.Create)
'loop through response stream reading each data block
'and writing to the local file
LOC_BytesRead = LOC_RespStream.Read(LOC_InData, 0, LOC_InData.Length)
While LOC_BytesRead > 0
LOC_Wrtr.Write(LOC_InData, 0, LOC_BytesRead)
LOC_BytesRead = LOC_RespStream.Read(LOC_InData, 0,
LOC_InData.Length)
End While
Catch Ex As Exception
'Set object of Exception. Calling application will have
'read only access to this object.
MsgBox(Ex.Message)
Finally
LOC_RespStream.Flush()
'Closing Response stream
LOC_RespStream.Close()
'Closing writer stream
LOC_Wrtr.Close()
End Try
End Sub 'DownloadFileBinary

Please guide me.
 
Yes, I have seen this, and for the life of me I cannot remember what
caused it, I'm sure it was some configuration issue on the server. I
guess you are having the problem when pull from Windows Server
2000/2003 but not from XP, which was when we also experienced the
problem, but a bit of googling turned up the fix. Sorry I can't
remember the details but hopefully this will point you in the right
direction!

Chris
 
I think what is need is something like this in the web.config file if you
want to use Get or Post

system.web>
<webServices>
<protocols>
<add name="HttpPost" />
<add name="HttpGet" />
</protocols>
</webServices>
</system.web>
 
Back
Top