1.在连接字符串后加上“sslMode=None” 解决数据库报错 “An exception has been raised that is likely due to a transient failure. Consider enabling transient error resiliency by adding 'EnableRetryOnFailure()' to the 'UseMySql' call.”

2.将日志单独文件大小改为1M
3.解决设备管理下 模式改动失败的问题
main
xiaoguo 1 year ago
parent 72feeff1b6
commit 2f29fa47a3

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<!--
IIS configuration sections.
@ -17,6 +17,7 @@
%SYSTEMDRIVE% - The drive letter of %IIS_BIN%
-->
<configuration>
<!--
@ -117,7 +118,7 @@
<section name="rewriteMaps" overrideModeDefault="Allow" />
</sectionGroup>
<section name="webSocket" overrideModeDefault="Deny" />
<section name="aspNetCore" overrideModeDefault="Allow" /></sectionGroup>
</sectionGroup>
</configSections>
<configProtectedData>
@ -162,7 +163,7 @@
</site>
<siteDefaults>
<!-- To enable logging, please change the below attribute "enabled" to "true" -->
<logFile logFormat="W3C" directory="%AppData%\Microsoft\IISExpressLogs" enabled="false" />
<logFile logFormat="W3C" directory="%AppData%\Microsoft\IISExpressLogs" enabled="false"/>
<traceFailedRequestsLogging directory="%AppData%\Microsoft" enabled="false" maxLogFileSizeKB="1024" />
</siteDefaults>
<applicationDefaults applicationPool="Clr4IntegratedAppPool" />
@ -247,8 +248,6 @@
<add name="ManagedEngineV4.0_32bit" image="%windir%\Microsoft.NET\Framework\v4.0.30319\webengine4.dll" preCondition="integratedMode,runtimeVersionv4.0,bitness32" />
<add name="ManagedEngineV4.0_64bit" image="%windir%\Microsoft.NET\Framework64\v4.0.30319\webengine4.dll" preCondition="integratedMode,runtimeVersionv4.0,bitness64" />
<add name="ApplicationInitializationModule" image="%IIS_BIN%\warmup.dll" />
<add name="AspNetCoreModule" image="%IIS_BIN%\aspnetcore.dll" />
<add name="AspNetCoreModuleV2" image="%IIS_BIN%\Asp.Net Core Module\V2\aspnetcorev2.dll" />
</globalModules>
<httpCompression directory="%TEMP%">
@ -259,7 +258,6 @@
<add mimeType="application/x-javascript" enabled="true" />
<add mimeType="application/javascript" enabled="true" />
<add mimeType="*/*" enabled="false" />
<add mimeType="text/event-stream" enabled="false" />
</dynamicTypes>
<staticTypes>
<add mimeType="text/*" enabled="true" />
@ -828,7 +826,6 @@
<add name="Rewrite" value="1024" />
<add name="FastCGI" value="4096" />
<add name="WebSocket" value="16384" />
<add name="ANCM" value="65536" />
</areas>
</add>
<add name="ASP" guid="{06b94d9a-b15e-456e-a4ef-37c984a2cb4b}">
@ -923,8 +920,6 @@
<add name="ConfigurationValidationModule" lockItem="true" />
<add name="UrlRoutingModule-4.0" type="System.Web.Routing.UrlRoutingModule" preCondition="managedHandler,runtimeVersionv4.0" />
<add name="ScriptModule-4.0" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" preCondition="managedHandler,runtimeVersionv4.0" />
<add name="AspNetCoreModule" lockItem="true" />
<add name="AspNetCoreModuleV2" lockItem="true" />
</modules>
<handlers accessPolicy="Read, Script">
<!-- <add name="WebDAV" path="*" verb="PROPFIND,PROPPATCH,MKCOL,PUT,COPY,DELETE,MOVE,LOCK,UNLOCK" modules="WebDAVModule" resourceType="Unspecified" requireAccess="None" /> -->

Binary file not shown.

@ -33,12 +33,13 @@ namespace PVDEMCS.Common.Log
/// 写入Error级别日志
/// </summary>
/// <param name="ex">异常对象</param>
public static void WriteErrorLog(this Exception ex)
public static void WriteErrorLog(this Exception ex,string title="")
{
var error = new StringBuilder();
error.AppendLine(title);
while (ex != null)
{
error.AppendLine($"{ex.Message}:{Environment.NewLine}");
error.AppendLine($"{ex.Message}");
error.AppendLine($"{ex.StackTrace};");
ex = ex.InnerException;
}
@ -49,12 +50,13 @@ namespace PVDEMCS.Common.Log
/// 写入Fatal级别日志
/// </summary>
/// <param name="ex">异常对象</param>
public static void WriteFatalLog(this Exception ex)
public static void WriteFatalLog(this Exception ex, string title = "")
{
var error = new StringBuilder();
error.AppendLine(title);
while (ex != null)
{
error.AppendLine($"{ex.Message}:{Environment.NewLine}");
error.AppendLine($"{ex.Message}");
error.AppendLine($"{ex.StackTrace};");
ex = ex.InnerException;
}

@ -102,8 +102,16 @@ namespace PVDEMCS.Devices.Impl
{
foreach (var item in monitors)
{
var task = item.StartAsync();
try
{
var task = item.StartAsync();
}
catch (Exception ex)
{
ex.WriteErrorLog("监控设备连接异常");
}
}
Thread.Sleep(5000);
}
});
@ -113,17 +121,9 @@ namespace PVDEMCS.Devices.Impl
{
while (true)
{
try
{
RunEquipmentRecord();
Thread.Sleep(3000);
}
catch (Exception ex)
{
ex.WriteErrorLog();
}
RunEquipmentRecord();
Thread.Sleep(3000);
}
});
@ -135,14 +135,14 @@ namespace PVDEMCS.Devices.Impl
try
{
equipmentRecordService.RunEquipmentRecordDayTotal(DateTime.Now);
Thread.Sleep(1000 * 60);
}
catch (Exception ex)
{
ex.WriteErrorLog();
ex.WriteErrorLog("设备记录日统计异常");
}
Thread.Sleep(1000 * 60);
}
});
@ -151,7 +151,15 @@ namespace PVDEMCS.Devices.Impl
{
while (true)
{
equipmentRecordService.RunEquipmentRecordTotal();
try
{
equipmentRecordService.RunEquipmentRecordTotal();
}
catch (Exception ex)
{
ex.WriteErrorLog("设备记录统计异常");
}
Thread.Sleep(1000 * 1800);
}
});
@ -211,11 +219,10 @@ namespace PVDEMCS.Devices.Impl
}
}
}
catch (Exception ex)
{
ex.WriteErrorLog();
ex.WriteErrorLog("记录设备数据异常");
}
}

@ -19,7 +19,7 @@
maxArchiveFiles="999"
archiveFileName="${basedir}/logs/${appName}-${shortdate}-${###}.log"
createDirs="true"
archiveAboveSize="102400"
archiveAboveSize="1048576"
archiveEvery="Day"
encoding="UTF-8"
/>

@ -181,6 +181,8 @@ namespace PVDEMCS.Services.Repositories
update.Activated = entity.Activated;
update.OrdrNo = entity.OrdrNo;
update.Remark = entity.Remark;
update.Model = entity.Model;
update.IsAlarm = entity.IsAlarm;
update.Update();
context.SaveChanges();

@ -1,6 +1,6 @@
{
"ConnectionStrings": {
"MySqlConnection": "Server=127.0.0.1;Port=3306;Database=pvdemcs;Uid=root;Pwd=123456;pooling=true;connection lifetime=0;min pool size = 1;max pool size=500"
"MySqlConnection": "Server=127.0.0.1;Port=3306;Database=pvdemcs;Uid=root;Pwd=123456;pooling=true;connection lifetime=0;min pool size = 1;max pool size=500;sslMode=None;"
},
"Logging": {
"LogLevel": {

@ -1,4 +1,4 @@
# VITE_BASE_API=http://192.168.10.246:9001/smart
# VITE_BASE_API=http://10.34.48.206:9000/smart
VITE_BASE_API=http://192.168.10.241:5223/
VITE_BASE_API=http://192.168.88.10:5223/
Loading…
Cancel
Save