The leading provider of version control solution and TWAIN SDK

Error message: The handle is in the wrong state for the requested operation

Symptom:

When you upload images, you may receive the following error messages returned by the ErrorString property:



Cause:

1. The size of images you are going to upload goes beyond the maximum transferable data size which is defined by the server.
2. The port number of the HTTP server is not defined in your code.
3. The server name is invalid.

Resolutions:

1. Please reset the maximum transferable data size:

If you are using ASP:

If you are using IIS 6:
1) Start -> Run , type "cmd"
2) Go to "C:\Inetpub\AdminScripts" by typing: cd C:\Inetpub\AdminScripts
3) To view max request entity allowed:
cscript adsutil.vbs get w3svc/AspMaxRequestEntityAllowed

If you are using IIS :
1) Start -> Run , type "InetMgr" to open IIS 7 Manager
2) {Your WebSite}->Feature View->ASP->Limites Properties
3) Set "Maximum Requesting Entity Body Limit" to a bigger value like "1000000"


To set max request entity allowed:
cscript adsutil.vbs set w3svc/AspMaxRequestEntityAllowed 1000000 (You can change the value by yourself.)

If you are using ASP.NET, you can change the value at the following line in the "Web.Config" file.
<httpRuntime maxRequestLength="1000000"/> (You can change the value by yourself.)

If you are using PHP, you can change the value at the following line in the php.ini file:
upload_max_filesize = 2M (You can change the value by yourself.)

2. Please set the port number of the HTTP server in your code. You can use the HTTPPort property to set the port number. Click here for more information about this property.

3. The problem may occur when you use "localhost" as the server name in the HTTP Upload method, while actually, you specify the address on your server using an IP address. In this case, please modify the server name to an available IP address in your code and then try again.

References:

HTTPUploadThroughPost




Article Details

Last Updated
8th o June, 2011

Would you like to...

Print this page Print this page

Email this page Email this page

Post a comment Post a comment

Subscribe me

Add to favorites Add to favorites

Remove Highlighting Remove Highlighting

Edit this Article

Quick Edit

Export to PDF

User Opinions (2 votes)

50% thumbs up 50% thumbs down

How would you rate this answer?



Thank you for rating this answer.

Related Articles

No related articles were found.

Attachments

No attachments were found.

Visitor Comments

No visitor comments posted. Post a comment

Post a comment

To post a comment for this article, simply complete the form below. Fields marked with an asterisk are required.
   Name:
   Email:
* Comment:
* Enter the code below:
 

Continue