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