chatop2020 / StreamNode-GB28181

本项目是基于ZLMediaKit的流媒体控制管理接口平台,支持RTSP,GB28181的设备拉流与推流控制,GB28181支持PTZ控制。
151 stars 62 forks source link

在windows下运行 StreamNodeWebApi报以下错误 #1

Closed lawrencehj closed 3 years ago

lawrencehj commented 3 years ago

C:\Users\lawre\source\repos\Git_Projects\StreamNode - GB28181\StreamNodeWebApi\bin\Debug\netcoreapp3.1>streamnodewebapi Starting logging initialisation. 2020-10-09 13:59:22.697 [Debug]: Target framework: .Net Core 3.1 2020-10-09 13:59:22.701 [Debug]: EnvironmentVariables.MICRO_REGISTRY_ADDRESS: 2020-10-09 13:59:22.702 [Debug]: EnvironmentVariables.GB_NATS_CHANNEL_ADDRESS: 2020-10-09 13:59:22.702 [Debug]: EnvironmentVariables.DEVICE_MANAGEMENT_SERVICE_ADDRESS: 2020-10-09 13:59:22.702 [Debug]: EnvironmentVariables.SYSTEM_CONFIGURATION_SERVICE_ADDRESS: 2020-10-09 13:59:22.703 [Debug]: EnvironmentVariables.GB_SERVICE_LOCAL_IP: 2020-10-09 13:59:22.704 [Debug]: EnvironmentVariables.GB_SERVICE_LOCAL_ID: 2020-10-09 13:59:22.704 [Debug]: EnvironmentVariables.GBServerGrpcPort: 50051 2020-10-09 13:59:22.704 [Debug]: Notes: if EnvironmentVariables have no value, it gets from xml config. 2020-10-09 13:59:22.864 [Debug]: Load assets from xml with local ip&port is 192.168.0.100:5060 2020-10-09 13:59:22.868 [Debug]: 1 GB28181.App.SIPAccount assets loaded from XML record set. 2020-10-09 13:59:22.869 [Debug]: Starting file watch on C:\Users\lawre\source\repos\Git_Projects\StreamNode - GB28181\StreamNodeWebApi\bin\Debug\netcoreapp3.1\Config\gb28181.xml. 2020-10-09 13:59:22.886 [Debug]: SIPRegistrarCore is running at Udp:192.168.0.100:5060 2020-10-09 13:59:22.888 [Debug]: SIPMessageCore is runing at udp:192.168.0.100:5060 [2020-10-9 13:59:22] 启动日志转存服务...(循环间隔:600000ms) 2020-10-09 13:59:22.909 [Debug]: SIPUDPChannel socket on 0.0.0.0:5060 listening started. info: Microsoft.Hosting.Lifetime[0] Now listening on: http://[::]:5800 info: Microsoft.Hosting.Lifetime[0] Application started. Press Ctrl+C to shut down. info: Microsoft.Hosting.Lifetime[0] Hosting environment: Production info: Microsoft.Hosting.Lifetime[0] Content root path: C:\Users\lawre\source\repos\Git_Projects\StreamNode - GB28181\StreamNodeWebApi\bin\Debug\netcoreapp3.1 报错了: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(3), UpdateTime DATETIME(3), Activated BIT(1), PRIMARY KEY (Id' at line 19 at FreeSql.Internal.CommonProvider.CodeFirstProvider.SyncStructure(TypeAndName[] objects) at FreeSql.Internal.CommonProvider.CodeFirstProvider.SyncStructure[TEntity]() at FreeSql.Internal.CommonProvider.Select0Provider2..ctor(IFreeSql orm, CommonUtils commonUtils, CommonExpression commonExpression, Object dywhere) at FreeSql.Internal.CommonProvider.Select1Provider1..ctor(IFreeSql orm, CommonUtils commonUtils, CommonExpression commonExpression, Object dywhere) at FreeSql.MySql.Curd.MySqlSelect1..ctor(IFreeSql orm, CommonUtils commonUtils, CommonExpression commonExpression, Object dywhere) at FreeSql.MySql.MySqlProvider1.Select[T1]() at StreamNodeWebApi.AutoTasker.CameraAutoKeeper.keeperCamera() in C:\Users\lawre\source\repos\Git_Projects\StreamNode - GB28181\StreamNodeWebApi\AutoTasker\CameraAutoKeeper.cs:line 455 报错了: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(3), UpdateTime DATETIME(3), Activated BIT(1), PRIMARY KEY (Id' at line 19 at FreeSql.Internal.CommonProvider.CodeFirstProvider.SyncStructure(TypeAndName[] objects) at FreeSql.Internal.CommonProvider.CodeFirstProvider.SyncStructure[TEntity]() at FreeSql.Internal.CommonProvider.Select0Provider2..ctor(IFreeSql orm, CommonUtils commonUtils, CommonExpression commonExpression, Object dywhere) at FreeSql.Internal.CommonProvider.Select1Provider1..ctor(IFreeSql orm, CommonUtils commonUtils, CommonExpression commonExpression, Object dywhere) at FreeSql.MySql.Curd.MySqlSelect1..ctor(IFreeSql orm, CommonUtils commonUtils, CommonExpression commonExpression, Object dywhere) at FreeSql.MySql.MySqlProvider1.Select[T1]() at StreamNodeWebApi.AutoTasker.CameraAutoKeeper.keeperCamera() in C:\Users\lawre\source\repos\Git_Projects\StreamNode - GB28181\StreamNodeWebApi\AutoTasker\CameraAutoKeeper.cs:line 455

用的是MySQL 5.5.49,已创建streamnode数据库

lawrencehj commented 3 years ago

查到原因了,是MySQL 5.5版不支持字段类型为datetime且默认值为NOW()的建表语句,升级到5.7.30版,问题解决。

chatop2020 commented 3 years ago

感谢测试,我已将readme.md中mysql版本要求写成mysql5.7及以上了。

2881099 commented 3 years ago

datetime(3)的问题,解决办法:

1、[Column(DbType = "DATETIME")]

2、统一处理的话写个AOP

fsql.Aop.ConfigEntityProperty += (s, e) =>
{
    if (e.Property.PropertyType == typeof(DateTime) || e.Property.PropertyType == typeof(DateTime?))
         e.ModifyResult.DbType = "DATETIME";
};

3、升级到 MySql 5.7.30