How to access API of third party dll's in ASP.NET Core project RRS feed

  • Question

  • User-1167631307 posted

    I'm getting the error "The configuration is not loaded yet " when accessing the API from third party reference. What is the way to refer third party DLL's in ASP.NET Core project 3.1.

    Here is the code 

    public IActionResult getVesselScheduleJson([DataSourceRequest]DataSourceRequest request, string searchId)
    List<LBCTVesselVisit> vesselSchResponse = new List<LBCTVesselVisit>();
    List<LBCTVesselVisit> removeList = new List<LBCTVesselVisit>();
    List<VesselSchInfo> listOfVesselInfo = new List<VesselSchInfo>();
    JsonResult json = null;
    _logger1.LogInformation("Weather forecast ready!");
    vesselSchResponse = LBCT.N4.Model.Access.Vessel.LBCTVesselVisitAccess.SharedInstance.GetActiveVesselVisits();

    if (vesselSchResponse.Count > 0)
    AddOperationCache(vesselSchResponse, gbParam.VesselScheduleVisitData);

    catch (Exception e)
    _logger.Error(e.Message, e);
    _logger.Error("StackTrace = " + e.StackTrace);


    When calling GetActiveVesselVisits() getting the exception. 

    do we need to add any modification in Startup.cs file. Please provide me more details.

    Monday, July 20, 2020 7:00 AM

All replies

  • User753101303 posted


    Could it be that it requires calling first an initialization method provided by this product? I would likely start by checking the documentation for this product.

    The full exception details could perhaps help.

    Edit: it is called from the controller or do you try to call this at startup or whatever ?

    Monday, July 20, 2020 9:51 AM
  • User-1167631307 posted

    Hi PatriceSc,

    it is called from the controller.

    Do we need to do configuration level changes in order to access the API of dll

    Monday, July 20, 2020 10:02 AM
  • User-474980206 posted

    You will need to check the docs of the 3rd party dll for configuration information. If it’s designed for asp.net core, they probably planned on it being injected.

    Monday, July 20, 2020 2:23 PM
  • User753101303 posted

    So it seems to really require some configuration prior to the first call. Please check the documentation for this product in which you should find how to proceed.

    Monday, July 20, 2020 2:32 PM
  • User-1167631307 posted

    Please provide specific documentation link for this. Thanks.

    Tuesday, July 21, 2020 5:09 AM
  • User711641945 posted

    Hi kalva,

    What is your third party dll?You need share enough information then we could reproduce your issue.

    Best Regards,


    Tuesday, July 21, 2020 6:43 AM
  • User753101303 posted

    You got this DLL from where? They don't provide any documentation?

    Edit: from a search it seems it could be related to https://www.navis.com/en/products/terminal-solutions/n4-terminal-operating-system/ It would be surprising that they don't provide some documentation to their customers.

    Tuesday, July 21, 2020 7:35 AM
  • User-1167631307 posted

    can you please provide me sample code for accessing API of DLL(was built in .NET Framework) in asp.net core MVC project.

    Tuesday, July 21, 2020 11:10 AM
  • User753101303 posted

    It won't help. Once you added a reference to a library you can just use its objects as usual ie :

    var o=new ThirdParty.APIBranding.MyObject(); // create an object
    o.DoSomething(); // use it

    For now it seems that this library needs a configuration step likely done at startup. There is no way to guess about what is needed and you should look at the documentation for this product.

    Edit: or this library is not compatible with ASP.NET Core? Compatibility is done through .NET Standard. See https://docs.microsoft.com/en-us/dotnet/core/tutorials/library-with-visual-studio and https://docs.microsoft.com/en-us/dotnet/standard/net-standard for general information.

    Edit 2: if it was the case I expect another message and I expect this to not even compile.

    Tuesday, July 21, 2020 11:55 AM
  • User-474980206 posted

    we can not give sample code to api we do not know the methods of.

    but here is a sample calling dapper's Query method (a 3rd party api)

    var sql = "SELECT * FROM Invoices";
    using (var conn = My.ConnectionFactory())
        var invoices = conn.Query<Invoice>(sql);

     note: .net core can not call a dll written in the old .net framework (4.*)


    Tuesday, July 21, 2020 5:25 PM
  • User-1167631307 posted


    I tried in the same way but I got the below error 

    "Configuration has not been loaded yet."

    at LBCT.Util.Configuration.LBCTConfigurationManager.CheckConfiguration()
    at LBCT.Util.Configuration.LBCTConfigurationManager.GetConfigurationValue(String parameter, Boolean nullCheck, Boolean checkConfiguration)
    at LBCT.Util.Configuration.LBCTConfigurationManager.GetConfigurationValueAsString(String parameter, Boolean nullCheck)
    at LBCT.Util.Configuration.LBCTConfigurationManager.GetConfigurationValueAsString(String parameter)
    at LBCT.N4.Services.LBCTBaseN4Service.AdminBasicInvoke(String xml)
    at LBCT.N4.Services.Vessel.LBCTVesselServices.GetActiveVessels()
    at LBCT.N4.Model.Access.Vessel.LBCTVesselVisitAccess.GetActiveVesselVisits()
    at LBCT.COM.Controllers.OperationsController.getVesselScheduleJson(DataSourceRequest request, String searchId) in C:\New folder (4)\LBCT\Controllers\OperationsController.cs:line 259

    Friday, July 24, 2020 4:28 AM
  • User753101303 posted

    So it seems to confirm you have a LBCTConfigurationManager that loads configuration settings  and throws an exception likely because some required settings are missing.

    As told multiple times, we have no way to guess which settings are required by this library and even less which values you should use. You should look at the product documentation to see which settings are needed.

    Friday, July 24, 2020 9:48 AM