Operation Failed The Server was Unable to Process the Request due to an Internal Error Opening Shortcut with Validation Script
Issue
Attempts to open a Shortcut in the Kofax Front Office Server Thin Client that points to a Form Type that contains a Validation Script results in the following error:
Operation failed. Error: the server was unable to process the request due to an internal error. For more information about the error, either turn on IncludeExceptionDetailInFaults (either from ServiceBehaviorAttribute or from the configuration behavior) on the server in order to send the exception information back to the client, or turn on tracing as per the Microsoft .NET Framework SDK documentation and inspect the server trace logs.
Cause
This error can occur if the Kofax Capture Validation Script is missing the required assembly reference to the Kofax.KFS.KFSValidation.dll library. This library allows KFS to read the Validation Script. It also allows the developer to define the context(s) in which each event contained within the script will fire (KofaxCapture, KofaxFrontOfficeServerWebClient, and/or KofaxFrontOfficeServerDevice).
Solution
To resolve this issue:
- Open the Kofax Capture Administration Module
- Select the affected Batch Class
- Right-click on the Document Class and select Document Validation Script
- Click Edit
- The Validation Script project will open in Microsoft Visual Studio
- Add an assembly reference to
Kofax.KFS.KFSValidation.dll
, which is located in the following folder on the KFS server:- KFS 4.1:
C:\Program Files (x86)\Kofax\Front Office Server 4.1\kfsService
- KFS 4.3:
C:\Program Files (x86)\Kofax\Front Office Server 4.3\kfsService
- KFS 4.1:
- Add the following declarations in the Validation Script file:
-
VB.NET:
Imports Kofax.KFSLib.KFSValidation
and
' Loads the Kofax Front Office Validation library from the same directory as the compiled ' validation script. This handler is required because the library is not in the the same ' directory as the Kofax Capture Validation executable. Function KFSLibResolveEventHandler(ByVal sender As Object, ByVal args As ResolveEventArgs) As Assembly Dim assemblyDir As String = Path.GetDirectoryName(Assembly.GetExecutingAssembly.CodeBase) Dim assemblyUri As Uri = New Uri(Path.Combine(assemblyDir, "Kofax.KFSLib.KFSValidation.dll")) Return Assembly.LoadFile(assemblyUri.AbsolutePath) End Function
-
C#:
using Kofax.KFSLib.KFSValidation;
and
// Loads the Kofax Front Office Validation library from the same directory as the compiled // validation script. This handler is required because the library is not in the the same // directory as the Kofax Capture Validation executable. Assembly KFSLibResolveEventHandler(object sender, ResolveEventArgs args) { string assemblyDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().CodeBase); Uri assemblyUri = new Uri(Path.Combine(assemblyDir, "Kofax.KFSLib.KFSValidation.dll")); return Assembly.LoadFile(assemblyUri.AbsolutePath); }
-
- Recompile the Validation Script
- Republish the Batch Class.
For more information about Customizing Validations Scripts for use in Kofax Front Office Server, see Chapter 9 of the Kofax Front Office Server Administrator's Guide, located in:
C:\Program Files (x86)\Kofax\Front Office Server 4.1\Documentation
And the Kofax Front Office Server API Reference and the Sample scripts located in:
- KFS 4.1:
C:\Program Files (x86)\Kofax\Front Office Server 4.1\DeveloperResources
- KFS 4.3:
C:\Program Files (x86)\Kofax\Front Office Server 4.3\DeveloperResources
Level of Complexity
Moderate
Applies to
Product | Version | Build | Environment | Hardware |
---|---|---|---|---|
Kofax Front Office Server | 4.3 4.1 |
ALL | ALL | N/A |
References
N/A