I’ve been tasked with updating a .NET Framework application to .NET 8. I ran Microsoft’s migration tool, and it seemed to go well, with no errors, but I don’t know if there’s anything else I need to do. Trying to run the application locally for the first time, I’m getting this error:
[]
Program.cs:
using System;
using System.Collections.Generic;
namespace GenericEmail
{
class Program
{
static void Main(string[] args)
{
if (args.Length > 0)
{
ConfigSettings config = new ConfigSettings();
//the below will be passed in as parameters
config.reportType = args[0];
bool isAdminReport = false;
bool isTest = true;
if (args.Length > 1)
{
isAdminReport = Convert.ToBoolean(args[1]);
}
if (args.Length > 2)
{
isTest = Convert.ToBoolean(args[2]);
}
config.isAdminReport = isAdminReport;
config.isTest = isTest;
//the below are pulled from config file - specific to reportType param
-----> THIS IS WHERE THE EXCEPTION IS TRIGGERED--------> config.emailSubject = System.Configuration.ConfigurationManager.AppSettings["EmailSubject-" + config.reportType];
config.adminEmailAddresses = System.Configuration.ConfigurationManager.AppSettings["Admin-" + config.reportType];
config.noErrorMessage = System.Configuration.ConfigurationManager.AppSettings["NoError-" + config.reportType];`
Here is App.config:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=mytoken" requirePermission="false"/>
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>
</startup>
<appSettings>
<add key="TestEmailAddress" value="[email protected]"/>
<add key="EmailServer" value="smtp.myserver"/>
<add key="EnableSSL" value="false"/>
<add key="Port" value="25"/>
<add key="EmailSubject-Validation" value="Account # Errors and Unreconciled Jobs"/>
<add key="Admin-Validation" value="[email protected]; [email protected]; [email protected]; [email protected]"/>
<add key="NoError-Validation" value="There are no validation errors to report at this time."/>
<add key="EmailSubject-Blackout" value="Important: AESOP time entered on blackout date"/>
<add key="Admin-Blackout" value="[email protected]; [email protected]"/>
<add key="NoError-Blackout" value="There are no absences on blackout dates to report at this time."/>
<add key="EmailSubject-FFCRA" value="Authorization required for your absence entry"/>
<add key="Admin-FFCRA" value="[email protected]; [email protected]"/>
<add key="NoError-FFCRA" value="There are no FFCRA absences to report at this time."/>
<add key="Sender-FFCRA" value=" [email protected]"/>
<add key="EmailSubject-FFCRAReport" value="AESOP FFCRA Absence Report"/>
<add key="Admin-FFCRAReport" value="[email protected]; [email protected]"/>
<add key="NoError-FFCRAReport" value="There are no FFCRA absences to report at this time."/>
<add key="ClientSettingsProvider.ServiceUri" value=""/>
</appSettings>
<connectionStrings>
<add name="mu_report_dataEntities" connectionString="metadata=res://*/mu_report_data.csdl|res://*/mu_report_data.ssdl|res://*/mu_report_data.msl;provider=System.Data.SqlClient;provider connection string="data source=myserver;initial catalog=mytable;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient"/>
</connectionStrings>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="mssqllocaldb"/>
</parameters>
</defaultConnectionFactory>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer"/>
</providers>
</entityFramework>
<system.web>
<membership defaultProvider="ClientAuthenticationMembershipProvider">
<providers>
<add name="ClientAuthenticationMembershipProvider" type="System.Web.ClientServices.Providers.ClientFormsAuthenticationMembershipProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=mytoken" serviceUri=""/>
</providers>
</membership>
<roleManager defaultProvider="ClientRoleProvider" enabled="true">
<providers>
<add name="ClientRoleProvider" type="System.Web.ClientServices.Providers.ClientRoleProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=mytoken" serviceUri="" cacheTimeout="86400"/>
</providers>
</roleManager>
</system.web>
</configuration>
It’s been years since I’ve done any .NET coding and I barely remember anything. Any help is greatly appreciated!