Last post Jul 24, 2020 09:48 AM by PatriceSc
Jul 20, 2020 07:00 AM|kalva|LINK
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)
catch (Exception 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.
Jul 20, 2020 09:51 AM|PatriceSc|LINK
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 ?
Jul 20, 2020 10:02 AM|kalva|LINK
it is called from the controller.
Do we need to do configuration level changes in order to access the API of dll
Jul 20, 2020 02:23 PM|bruce (sqlwork.com)|LINK
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.
Jul 20, 2020 02:32 PM|PatriceSc|LINK
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.
Jul 21, 2020 05:09 AM|kalva|LINK
Please provide specific documentation link for this. Thanks.
Jul 21, 2020 06:43 AM|Rena Ni|LINK
What is your third party dll?You need share enough information then we could reproduce your issue.
Jul 21, 2020 07:35 AM|PatriceSc|LINK
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.
Jul 21, 2020 11:10 AM|kalva|LINK
can you please provide me sample code for accessing API of DLL(was built in .NET Framework) in asp.net core MVC project.
Jul 21, 2020 11:55 AM|PatriceSc|LINK
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
Edit 2: if it was the case I expect another message and I expect this to not even compile.
Jul 21, 2020 05:25 PM|bruce (sqlwork.com)|LINK
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.*)
Jul 24, 2020 04:28 AM|kalva|LINK
I tried in the same way but I got the below error
"Configuration has not been loaded yet."
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.COM.Controllers.OperationsController.getVesselScheduleJson(DataSourceRequest request, String searchId) in C:\New folder (4)\LBCT\Controllers\OperationsController.cs:line 259
Jul 24, 2020 09:48 AM|PatriceSc|LINK
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.