Reply
Highlighted
Member
Posts: 1
Registered: ‎12-30-2020

Initialization Issue in .netcore3.1

Need help with this. 

 

Getting an exception while executing the code below in .NET Core 3.1 works fine in .net core 2.2

 

ApiOperationBase<ANetApiRequest, ANetApiResponse>.RunEnvironment = AuthorizeNet.Environment.SANDBOX;

 

exception = The type initializer for 'AuthorizeNet.Api.Controllers.Bases.ApiOperationBase`2' threw an exception.

 

inner exception: Method not found: 'Microsoft.Extensions.Logging.ILoggerFactory Microsoft.Extensions.Logging.DebugLoggerFactoryExtensions.AddDebug(Microsoft.Extensions.Logging.ILoggerFactory, Microsoft.Extensions.Logging.LogLevel)'.

at AuthorizeNet.Utilities.LogFactory.get_LoggerFactory()
at AuthorizeNet.Utilities.LogFactory.getLog(Type classType)
at AuthorizeNet.Api.Controllers.Bases.ApiOperationBase`2..cctor()

 

 

Member
Posts: 5
Registered: ‎04-09-2021

Re: Initialization Issue in .netcore3.1

We are also experiencing this issue; were you able to resolve it?

Member
Posts: 5
Registered: ‎04-09-2021

Re: Initialization Issue in .netcore3.1

New Member
Posts: 1
Registered: ‎04-10-2021

Re: Initialization Issue in .netcore3.1

Add some logging during application startup so you can clearly see when the application started without hitting any application endpoints. For example, in the Program.Main method write a timestamp to a log file:

System.IO.File.AppendAllText(@"C:\Temp\mvc-log.txt", $"Main: {DateTime.Now}\n");

Publish the application to IIS. Grant your application pool user (or everyone) write access to the folder you're logging to (e.g. c:\temp). When you hit the site you should see a message written to the log file.

 

 

tellthebell