首页 > 其他分享 >dotnet6 项目在Docker部署报错 The type initializer for 'Gdip' threw an exception.

dotnet6 项目在Docker部署报错 The type initializer for 'Gdip' threw an exception.

时间:2023-05-15 19:57:02浏览次数:42  
标签:core exception dotnet6 System initializer 报错 Gdip type threw

asp .net core 部署在docker中,使用了System.Drawing.Common包,在容器中使用时报错“The type initializer for 'Gdip' threw an exception.”

原因:因为System.Drawing.Common在跨平台的兼容性不够理想,官方设置为后续版本只能在Windows平台使用,默认是不开启的,需要在运行时配置中开启才行。

解决步骤:1、首先得确认改环境中是否已安装了 libgdiplus和libc6-dev 包,没有需先根据项目运行系统进行对应安装

     2、在[appname].runtimeconfig.json 配置文件中增加以下配置

      { "runtimeOptions": { "configProperties": { "System.Drawing.EnableUnixSupport": true } } }

    3、重启项目服务

官方说明文档:https://learn.microsoft.com/en-us/dotnet/core/compatibility/core-libraries/6.0/system-drawing-common-windows-only

标签:core,exception,dotnet6,System,initializer,报错,Gdip,type,threw
From: https://www.cnblogs.com/CXY-Blog/p/17402883.html

相关文章

  • vue报错EISDIR: illegal operation on a directory, read解决
    报错:EISDIR:illegaloperationonadirectory,readInternalservererror:EISDIR:illegaloperationonadirectory,read原因:引入子组件时,子组件是xxx/文件夹名/index.vue,引入只写到了xxx/文件夹名解决:引入子组件时,路径写到xxx/文件夹名/index.vue......
  • 3D打印报错!! {"code":"key111", "msg": "Extrude below minimum temp
    问题:!!{"code":"key111","msg":"Extrudebelowminimumtemp 解决办法:在配置文件中修改:增加:min_extrude_temp:0......
  • 【jmeter】生成测试报告报错
    1、生成jmeter报告报错Consumerfailedwithmessage:Beginsize0isnotequaltofixedsize5 2、jmeter的jmx格式的聚合报告转换成html时报错Anerroroccurred:Reportgenerationrequirescsvoutputformat,check'jmeter.save.saveservice.output_format'proper......
  • 报错问题:谷粒商城Access to XMLHttpRequest at 'http://localhost:88/api/sys/login'
    大概在P46P47,跟着配置后出现问题AccesstoXMLHttpRequestat'http://localhost:88/api/sys/login'fromorigin'http://localhost:8001'hasbeenblockedbyCORSpolicy: 上网查了一下,说是跨域的问题,检查了一会,有人说是nacos的命名空间的问题,也有人说是版本上的问题,大多......
  • Opto SDK c++案例报错的解决
    环境:VS2019(使用x64)+Win10,下述代码有异常usingstd::experimental::filesystem::v1::path;将 #include<filesystem>改为 #include<experimental/filesystem>将_SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING添加到预处理器定义中(项目->属性->C/C++->预处......
  • android.content.res.Resources$NotFoundException: String resource ID #0x4
    问题描述:android.content.res.Resources$NotFoundException:StringresourceID#0x4翻译为:android.content.res。资源$NotFoundException:字符串资源ID#0x4。原因:类型转换错误,请查看报错的地方和传过来(或是从接口获取的类型)的类型是否一致......
  • java.lang.IllegalArgumentException: Illegal URL:
    问题描述: java.lang.IllegalArgumentException:IllegalURL:翻译为:IllegalArgumentException:非法网址:原因:网址错误,网址前面加http:// 后面加/ ;(如下图) ......
  • execjs - 编码报错问题解决方案
    当在Python中运行execjs时遇到编码问题,可能是由于JS代码中使用了非UTF-8编码。为了解决这个问题,您可以尝试以下两种方案最直接方法需要修改Subprocess中的Enconding为"Utf-8"将JS代码转换为UTF-8编码您可以在JS代码中将所有字符串转换为UTF-8编码。例如,您可以在JS代码文件......
  • org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit
    或者在POM中加入<plugins><plugin><groupId>org.codehaus.mojo</groupId><artifactId>exec-maven-plugin</artifactId><version>1.6.0</version><configuration><......
  • 3D打印机报错!! {"code":"key243","msg":"Move out of range: 20.852 29.68
    修改配置文件stepper_z的配置终点需要改下,看你热床允许的倾斜度,相对于归零点,负的,最大的值 ......