新服务器上的AutoMapper数据类型转换异常
我有一个ASP REST API,在VS中也可以在我们的旧服务器和测试系统上运行良好。但是,当我尝试访问API(不是全部)时,我会得到日期映射异常。 ,旧的服务器和新服务器的设置以及数据库以及仅数据库的设置相等
对我来说 在任何其他系统上重现错误。
AutoMapper.AutoMapperMappingException: Error mapping types.
Mapping types:
TTestingConfiguration -> TestingConfigurationDTO
Entities.TTestingConfiguration -> Models.TestingConfigurationDTO
Type Map configuration:
TTestingConfiguration -> TestingConfigurationDTO
Entities.TTestingConfiguration -> Models.TestingConfigurationDTO
Destination Member:
HexCreationDate
---> System.FormatException: 23.04.2020 13:27 is not a valid value for DateTime.
---> System.FormatException: String '23.04.2020 13:27' was not recognized as a valid DateTime.
at System.DateTime.Parse(String s, IFormatProvider provider)
at System.ComponentModel.DateTimeConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value)
--- End of inner exception stack trace ---
at System.ComponentModel.DateTimeConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value)
at System.ComponentModel.TypeConverter.ConvertFrom(Object value)
at AutoMapper.Mappers.TypeConverterMapper.Map[TSource,TDestination](TSource source)
at lambda_method2000(Closure , Object , TestingConfigurationDTO , ResolutionContext )
--- End of inner exception stack trace ---
at lambda_method2000(Closure , Object , TestingConfigurationDTO , ResolutionContext )
I have a asp rest api which runs fine on our old server and test systems as well in VS. But when i try to access apis (not all) i get an Date Time mapping exception. For me the old server and the new server are setup equal as well the database and the data only the old server is windows server 2012 and the new is window server 2022.
So I don't even know where to start looking because I can not reproduce the error on any other system.
AutoMapper.AutoMapperMappingException: Error mapping types.
Mapping types:
TTestingConfiguration -> TestingConfigurationDTO
Entities.TTestingConfiguration -> Models.TestingConfigurationDTO
Type Map configuration:
TTestingConfiguration -> TestingConfigurationDTO
Entities.TTestingConfiguration -> Models.TestingConfigurationDTO
Destination Member:
HexCreationDate
---> System.FormatException: 23.04.2020 13:27 is not a valid value for DateTime.
---> System.FormatException: String '23.04.2020 13:27' was not recognized as a valid DateTime.
at System.DateTime.Parse(String s, IFormatProvider provider)
at System.ComponentModel.DateTimeConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value)
--- End of inner exception stack trace ---
at System.ComponentModel.DateTimeConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value)
at System.ComponentModel.TypeConverter.ConvertFrom(Object value)
at AutoMapper.Mappers.TypeConverterMapper.Map[TSource,TDestination](TSource source)
at lambda_method2000(Closure , Object , TestingConfigurationDTO , ResolutionContext )
--- End of inner exception stack trace ---
at lambda_method2000(Closure , Object , TestingConfigurationDTO , ResolutionContext )
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论