Discussion:
WinInet Bug?
(too old to reply)
MichaelR
2004-08-09 14:52:37 UTC
Permalink
I'm getting a curious result from a module using WinInet on the client and
IIS 6.0/ASP.NET on the server. Can't really tell if it's a client or a
server issue.

The client module uses HttpSendRequestEx to open a request and
InternetWriteFile to send large text files in chunks. The pseudocode looks
like this:

- open a request ("POST")
- fill in file size in INTERNET_BUFFERS struct
- send HttpSendRequestEx
- begin a loop
- read x bytes from the input file
- write x bytes using InternetWriteFile
- end loop at end of file
- HttpEndRequest
- Check the status code from the server

This module is being used to send relatively large PostScript files (which
are text files). The server side of this connection is an .aspx page which
reads the request as a binary stream and writes out a file.

However, occasionally, the operation returns a status code 500 to the
client. The IIS log files also show a request with a status code 500. The
.aspx code is in a try/exception block and writes exception descriptions out
to the event log. When this error happens the exception description is
"Thread was being aborted".

The curious thing is that this is a very reproduceable situation. I have a
PowerPoint file with 13 slides in it. I can produce the PostScript text
file by printing to a file. Something in one of those slides (the 9th of
13) triggers this error. If I create a PostScript file with slide 1-8 and
10-13, no problem. A PostScript file that includes slide 9 (alone or with
other slides) triggers the error.

I can eliminate file size as an issue (I've successfully sent file 10 times
larger).
I can eliminate network interruptions as an issue. This happens every time
with specific files.

Any thoughts about what could be causing this? Is there any way to identify
if this is a client or a server issue?

Thanks,

Michael R.
Brian Combs
2004-08-10 14:35:42 UTC
Permalink
Hello
For a 500 status code I would first look at the server. 500 means that the
server got your requst gave it to who should handle the request, in your
case ASP.Net, and that the handler for the request had an error while
working on the request\response. If you sent bad data for the request the
server side code should have notified you of this. I would try and debug
the server side code so you can get a full stack trace to see what
happened.

Also look at the following article and see if it works.

323246 How To Upload a File to a Web Server in ASP.NET by Using Visual C#
.NET
http://support.microsoft.com/?id=323246

If you want to check client side I would get network trace to see the raw
request and response data.

Thanks
Brian [MSFT]
Microsoft Developer Support
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
| From: "MichaelR" <***@info-resonance.com>
| Subject: WinInet Bug?
| Date: Mon, 9 Aug 2004 10:52:37 -0400
| Lines: 50
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.3790.181
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.181
| Message-ID: <***@tk2msftngp13.phx.gbl>
| Newsgroups: microsoft.public.inetsdk.programming.wininet
| NNTP-Posting-Host: mail.info-resonance.com 199.171.27.66
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13.phx.gbl
| Xref: cpmsftngxa06.phx.gbl
microsoft.public.inetsdk.programming.wininet:11239
| X-Tomcat-NG: microsoft.public.inetsdk.programming.wininet
|
| I'm getting a curious result from a module using WinInet on the client and
| IIS 6.0/ASP.NET on the server. Can't really tell if it's a client or a
| server issue.
|
| The client module uses HttpSendRequestEx to open a request and
| InternetWriteFile to send large text files in chunks. The pseudocode
looks
| like this:
|
| - open a request ("POST")
| - fill in file size in INTERNET_BUFFERS struct
| - send HttpSendRequestEx
| - begin a loop
| - read x bytes from the input file
| - write x bytes using InternetWriteFile
| - end loop at end of file
| - HttpEndRequest
| - Check the status code from the server
|
| This module is being used to send relatively large PostScript files (which
| are text files). The server side of this connection is an .aspx page
which
| reads the request as a binary stream and writes out a file.
|
| However, occasionally, the operation returns a status code 500 to the
| client. The IIS log files also show a request with a status code 500.
The
| .aspx code is in a try/exception block and writes exception descriptions
out
| to the event log. When this error happens the exception description is
| "Thread was being aborted".
|
| The curious thing is that this is a very reproduceable situation. I have
a
| PowerPoint file with 13 slides in it. I can produce the PostScript text
| file by printing to a file. Something in one of those slides (the 9th of
| 13) triggers this error. If I create a PostScript file with slide 1-8 and
| 10-13, no problem. A PostScript file that includes slide 9 (alone or with
| other slides) triggers the error.
|
| I can eliminate file size as an issue (I've successfully sent file 10
times
| larger).
| I can eliminate network interruptions as an issue. This happens every
time
| with specific files.
|
| Any thoughts about what could be causing this? Is there any way to
identify
| if this is a client or a server issue?
|
| Thanks,
|
| Michael R.
|
|
|
|
|

Loading...