You are viewing limited content. For full access, please sign in.

Question

Question

OcrEngine.LoadEngine only works in IIS when impersonating an administrator

SDK
asked on February 9, 2015

I'm having a problem trying to get Laserfiche.DocumentServices.OcrEngine.LoadEngine to work from a Web Service. We call this web service for all of our LF SDK functions.
It works from test sample web service using VS Development Server, but when I switch to IIS, I get the error - "Object reference not set to an instance of an object."

After much trial and error, the only way it works in IIS is by impersonating a local administrator.

I'm using VS 2008 with FW v2.0 and LF 9.0, so I have a reference to

C:\Program Files\Laserfiche\SDK 9.0\bin\9.0\net-2.0\Laserfiche.DocumentServices.dll

Obviously, we don't want to impersonate an administrator in a website.

Does OcrEngine.LoadEngine need special permissions?


web.config -


<identity impersonate="true" userName="mydomain\UserInAdminGroup" password="xxxxxxxx"/>

Code -

Dim oSession As New Session()
LFLogin(oSession)
Dim docInfo As DocumentInfo = Nothing
docInfo = Document.GetDocumentInfo(sLaserficheTifFilePath, oSession)
Try
	docInfo.Lock(LockType.Exclusive)
	Using ocr As Laserfiche.DocumentServices.OcrEngine = Laserfiche.DocumentServices.OcrEngine.LoadEngine()
		ocr.AutoOrient = True
		ocr.Decolumnize = True
		ocr.OptimizationMode = OcrOptimizationMode.Accuracy
		ocr.Run(docInfo)
	End Using
Catch ex As Exception
	Throw
Finally
	docInfo.Unlock()
	docInfo.Dispose()
	oSession.LogOut()
End Try

 

0 0

Replies

replied on February 10, 2015

I should also add that I got this code from C:\WebsiteDocs\Laserfiche\SDK9.0Samples\LfSDKNetSamples.  Although this is not a website, it does work.  I am able to run it in VS2010, and LF 9.0, with a reference to

C:\Program Files\Laserfiche\SDK 9.0\bin\9.0\net-4.0\Laserfiche.DocumentServices.dll

 

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.