Custom script as a web service and VID_Write2Log: error FileNotFoundException

Hello to everybody

I have done a custom script that it works fine but when it is called as a web service (with the program function Common_StartScripts) it returns the following error:

{
"responseStatus": {
"errorCode": "FileNotFoundException",
"message": "Could not load file or assembly 'VI.DataImport, Version=8.1.0.0, Culture=neutral, PublicKeyToken=5d0660cde5b231wd' or one of its dependencies. The system cannot find the file specified.",
"errors": []
}
}

It seems that the problem is when I use the VID_Write2Log function in the script.

How can I resolve the problem?

Thank you in advance.

  • The script VID_Write2Log is probably not the reason. Your script uses the VI.DataImport.dll which is not installed in the AppServer by default, only on the JobService on the client installations.But you could add the the DLL to the AppServer via AutoUpdate if you assign the machine role Server\Web\ApplicationServer to the DLL using Base Data\One Identity Manager Software in Designer.

    Does your script use a DataFileImport object from the VI.DataImport namespace? 

  • Thanks for the quick answer.

    This is the beginning of the script.

    The script initially had a DataFileImport parameter but, in order to call it as a web service, I commented the parameter and the imports:

    #If Not SCRIPTDEBUGGER Then
    'References VI.DataImport.dll

    Imports System.Collections.Generic
    Imports System.IO
    Imports System.Globalization
    Imports VI.DB.Entities
    Imports VI.DB.Specialized
    'Imports VI.DataImport
    #End If

    'Public Sub CCC_UNSAccountB_Import(ByVal dfImport As DataFileImport)
    Public Sub CCC_UNSAccountB_Import_V2()

    ...

  • Looks like either the AppServer hasn't the latest version of your script assembly loaded or the reference to the VI.DataImport.dll is still present in some other scripts. If the latter is the case, the assembly loader attempts to resolve and load all dependencies and fails even if you scritp is not using DataImport. 

    So maybe the best is to add the DLL to the Application Server. 

  • We will check that DLL in the Application Server.

    Thanks again.

  • We finally refuse to call the script as a web service so we unchecked the program function Common_StartScripts option.