Welcome Guest! To enable all features, please Login or Register.



Last Go to last post Unread Go to first unread post
#1 Posted : Thursday, March 19, 2015 12:00:29 PM(UTC)


Groups: Registered
Posts: 9


Some days ago I posted a topic here about IIS hanging when doing OCR with thunking enabled:


When support asked me to send them a small application, I made it and tested before sending it, but to my surprise the problem didn't appear: no Win32 exception raised upon doing OCR in a web (iis) environment.

I thought I had found the culprit since I was spawning another thread in my original application, and thought that maybe the engine didn't like it.

I re-wrote my app and it seemed to work fine, until now. The Win32 exception appeared again, and it didn't happened before because I did my tests the wrong way.

After a couple of hours doing intensive debug of my application, I found the problem. Long story short: When using thunking, the Win32 exception appears if the call to IOcrPage.RecognizeText() is called with a delegate instead of null (or Nothing in vb).

I'm attaching a small test, that should be ran in IIS in order to check it:

Dim useDelegate as Boolean = True
Dim textResult as String
Leadtools.RasterSupport.SetLicense(licFile, dvk)
Using Codecs As New Leadtools.Codecs.RasterCodecs
Using engine = Leadtools.Forms.Ocr.OcrEngineManager.CreateEngine(Leadtools.Forms.Ocr.OcrEngineType.Professional, True) 'use thunking
engine.Startup(Nothing, Nothing, Nothing, Nothing)
Using doc As Leadtools.Forms.Ocr.IOcrDocument = engine.DocumentManager.CreateDocument()
Using image As Leadtools.RasterImage = Codecs.Load(file, 1)
Dim p As IOcrPage = doc.Pages.AddPage(image, Nothing)
If useDelegate = False Then
textResult = p.RecognizeText(Nothing) '<- This works
textResult = p.RecognizeText(Sub(data As IOcrProgressData)
'do nothing
End Sub) '<- This hangs the w3wp.exe process!!!
End If
Return x
End Using
End Using
End Using
End Using

Is there any other workaround for this besides not using a delegate?

Thank you


Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Friday, March 20, 2015 7:34:17 AM(UTC)


Groups: Guests
Posts: 3,022

Was thanked: 2 time(s) in 2 post(s)

I am going to need a little more information to help you solve this. Is the pasted code the "attached small sample" or did you attempt to attach a project? If so it did not attach, if it is too large do not forget to clean the solution first.

Looking at the sample you pasted though I'm not sure it is entirely correct, it looks like you are passing the wrong data into the RecognizeText().

Look at the example for the OcrProgressCallback at


Also what is the exception that you are receiving?
#3 Posted : Saturday, March 21, 2015 12:55:25 PM(UTC)


Groups: Registered
Posts: 9

Hello Nathan,

I'm trying to attach a sample visual studio project, (6MB aprox) but I keep receiving an error from the forum, and that it has been logged.

I'm sending it to support@leadtools.com and a link to this post.

Thank you.

You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2023, Yet Another Forum.NET
This page was generated in 0.058 seconds.