Running .net core console application from task scheduler produces connectionstring property has not been initialized. How do I fix this?

0

I have developed a .net core 2.2 console application using Visual Studio. The application runs great both in VS and as a stand alone application. However, when it is launched from task scheduler it give me the following errors.

Application error: Faulting application name: FaxageConsoleApplication.exe, version: 0.0.0.0, time stamp: 0x5d4cb4d5 Faulting module name: KERNELBASE.dll, version: 10.0.14393.3986, time stamp: 0x5f77fd5b Exception code: 0xe0434352 Fault offset: 0x0000000000034f38 Faulting process id: 0x2bd8 Faulting application start time: 0x01d6b38e1ce67da5 Faulting application path: C:\Program Files\faxageApplication\FaxageConsoleApplication.exe Faulting module path: C:\Windows\System32\KERNELBASE.dll Report Id: 50cad7cf-1098-4426-aa89-9dc6f6386ed5 Faulting package full name:

.Net Runtime Error: Application: FaxageConsoleApplication.exe CoreCLR Version: 4.6.28008.2 Description: The process was terminated due to an unhandled exception. Exception Info: System.InvalidOperationException: The ConnectionString property has not been initialized. at System.Data.SqlClient.SqlConnection.PermissionDemand() at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource1 retry, DbConnectionOptions userOptions) at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource1 retry) at System.Data.SqlClient.SqlConnection.Open() at FaxageConsoleApplication.DAL.FaxageDAL.GetPendingFaxes() in C:\GitAvacareRepo\FaxageConsoleApplication\FaxageConsoleApplication\FaxageConsoleApplication\DAL\FaxageDAL.cs:line 40 at FaxageConsoleApplication.Program.Main(String[] args) in C:\GitAvacareRepo\FaxageConsoleApplication\FaxageConsoleApplication\FaxageConsoleApplication\Program.cs:line 16

I have tried to locate a solution by goggling it but have not been able to locate one. Any help in solving this issue is much appreciated.

c#
asp.net-core
console-application
scheduled-tasks
asked on Stack Overflow Nov 5, 2020 by CJohn Ransom

1 Answer

0

After doing more research I can across the solution in another stack overflow post. Here is the link to that solution.

[https://stackoverflow.com/questions/43595119/schedule-a-net-core-console-application-on-windows-using-task-scheduler][1]

answered on Stack Overflow Nov 6, 2020 by CJohn Ransom

User contributions licensed under CC BY-SA 3.0