Jireh程序猿的那些事 Jireh程序猿的那些事

记录分享生活、程序、信息的精彩人生

目录
The requested FontFamily could not be found [GDI+ status: FontFamilyNotFound]
/      

The requested FontFamily could not be found [GDI+ status: FontFamilyNotFound]

因为平台需要,要将原来部署在Windows Server上的Asp.Net服务迁移到Linux上面。

为了方便直接用Jexus独立版的Docker镜像,省了中间Mono,Jexus相关环境的安装。

在登录的时候发现验证码不显示,查看后台日志,发现有报错

System.ArgumentException: The requested FontFamily could not be found [GDI+ status: FontFamilyNotFound]
  at System.Drawing.GDIPlus.CheckStatus (System.Drawing.Status status) [0x001ce] in <e6d393b11eca475db6e22ed1cbeb1518>:0 
  at System.Drawing.FontFamily..ctor (System.Drawing.Text.GenericFontFamilies genericFamily) [0x0004d] in <e6d393b11eca475db6e22ed1cbeb1518>:0 
  at (wrapper remoting-invoke-with-check) System.Drawing.FontFamily..ctor(System.Drawing.Text.GenericFontFamilies)
  at System.Drawing.FontFamily.get_GenericSansSerif () [0x00000] in <e6d393b11eca475db6e22ed1cbeb1518>:0 
  at System.Drawing.Font.CreateFont (System.String familyName, System.Single emSize, System.Drawing.FontStyle style, System.Drawing.GraphicsUnit unit, System.Byte charSet, System.Boolean isVertical) [0x00011] in <e6d393b11eca475db6e22ed1cbeb1518>:0 
  at System.Drawing.Font..ctor (System.String familyName, System.Single emSize, System.Drawing.FontStyle style, System.Drawing.GraphicsUnit unit, System.Byte gdiCharSet, System.Boolean gdiVerticalFont) [0x00011] in <e6d393b11eca475db6e22ed1cbeb1518>:0 
  at System.Drawing.Font..ctor (System.String familyName, System.Single emSize) [0x00000] in <e6d393b11eca475db6e22ed1cbeb1518>:0 
  at (wrapper remoting-invoke-with-check) System.Drawing.Font..ctor(string,single)
  at verify_code.ProcessRequest (System.Web.HttpContext context) [0x001ce] in <2b0616f0c0e340749a35e5c3bfc06084>:0 
  at System.Web.HttpApplication+<Pipeline>d__225.MoveNext () [0x008fd] in <a0cf28d1b51f4484bc8478653eeeba81>:0 
  at System.Web.HttpApplication.Tick () [0x00000] in <a0cf28d1b51f4484bc8478653eeeba81>:0

原因

The requested FontFamily could not be found [GDI+ status: FontFamilyNotFound]

这是Jexus容器中Ubuntu环境没有安装相应的字体环境造成的

解决

进入jexus容器当中

docker exec -it jexus bash

安装libgdiplus软件

apt-get -q update
apt-get -y -q install libgdiplus

如果觉得这篇文章不错的话,请我喝一杯 咖啡☕吧
标题:The requested FontFamily could not be found [GDI+ status: FontFamilyNotFound]
作者:Jireh
地址:https://www.lyile.cn/articles/2021/06/08/1623115153847.html
本作品由 Jireh 采用 署名 – 非商业性使用 – 禁止演绎 4.0 国际许可协议进行许可,转载请注明出处。