.net core 部署在Centos 7/8 的几个小坑

.net core 部署在centos 7/8下,当然没有在windows 下那么顺畅。遇到几个小坑,虽然波折,也算顺利填坑。

仅自我记录,以供日后忘记可回头翻阅

 

一、使用Nginx反向代理后,获取访问域名,会一直是localhost问题。

Nginx反向代理配置增加:

proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;

 

二、程序请求https远程资源,比如请求微信接口等。提示:System.Net.WebException: The SSL connection could not be established, see inner exception.

/etc/pki/tls/cert.pem 复制到 /usr/local/openssl/

 

三、使用System.Drawing 报错:

System.TypeInitializationException: The type initializer for 'Gdip' threw an exception.
 ---> System.DllNotFoundException: Unable to load shared library 'libgdiplus' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: liblibgdiplus: cannot open shared object file: No such file or directory
   at System.Drawing.SafeNativeMethods.Gdip.GdiplusStartup(IntPtr& token, StartupInput& input, StartupOutput& output)
   at System.Drawing.SafeNativeMethods.Gdip..cctor()

解决办法:

yum update
yum install libgdiplus-devel -y
ln -s /usr/lib64/libgdiplus.so /usr/lib/gdiplus.dll
ln -s /usr/lib64/libgdiplus.so /usr/lib64/gdiplus.dll

 

 

 

---------------无聊的分割线----------------

暂时这些,有多再继续追加。。。。。

posted @ 2020-12-25 15:45  漫遊者  阅读(438)  评论(0编辑  收藏  举报