diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/NgRepairsController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/NgRepairsController.cs index 616ebf7c..858b699e 100644 --- a/AMESCoreStudio.WebApi/Controllers/AMES/NgRepairsController.cs +++ b/AMESCoreStudio.WebApi/Controllers/AMES/NgRepairsController.cs @@ -30,6 +30,8 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES /// public NgRepairsController(AMESContext context) { + _config = new ConfigurationBuilder().SetBasePath(Environment.CurrentDirectory).AddJsonFile("appsettings.json").Build(); + _context = context; } @@ -1220,7 +1222,7 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES mailBody = mailBody + "警報時間:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "
"; mailBody = mailBody + "警報原因:" + alarmDesc + "
"; - string mailFrom = _config["MailForm"].ToString(); + string mailFrom = _config["MailFrom"].ToString(); //string mailTo = _config["MailTo"].ToString(); string mailSmtpServer = _config["MailSmtpServer"].ToString(); int mailSmtpPort = int.Parse(_config["MailSmtpPort"].ToString()); diff --git a/AMESCoreStudio.WebApi/appsettings.json b/AMESCoreStudio.WebApi/appsettings.json index 32d48456..c96fb7f3 100644 --- a/AMESCoreStudio.WebApi/appsettings.json +++ b/AMESCoreStudio.WebApi/appsettings.json @@ -14,7 +14,7 @@ }, "MailSmtpServer": "", "MailSmtpPort": "25", - "MailForm": "", + "MailFrom": "", "MailUser": "", "MailUserPassword": "", //"MailTo": "",