Dotnetcore 开发速记
1、System.InvalidOperationException:"Internal connection fatal error."
全球固定模式,坑爹
2、反射按nuget包名进行
通过nuget引用的包,不会复制以运行目录,反射时按包名反射
library.Dependencies
3、Cache使用
new RedisCache(new RedisCacheOptions { Configuration = Configuration.GetConnectionString("RedisConnection"), InstanceName = "AC:" })
services.AddDistributedRedisCache(options => { options.Configuration = Configuration.GetConnectionString("RedisConnection"); options.InstanceName = "AC:"; }); |
参考:https://github.com/aspnet/Extensions/tree/master/src/Caching
https://www.cnblogs.com/Leo_wl/p/6392196.html?utm_source=itdadao&utm_medium=referral
https://www.e-learn.cn/content/net/405845
Linux下安装NETCORE
#netcor 安装脚本 #vi /etc/sysconfig/network-scripts/ifcfg-eth0 (可能不是这个名字),将onboot=no修改为yes ip addr service network restart ip addr
#使用CRT登录方便复制 su
yum -y install net-tools ifconfig mkdir /opt/dotnet cd /opt/dotnet
yum -y install wget yum -y install icu
wget -c https://dot.net/v1/dotnet-install.sh
chmod +x dotnet-install.sh ./dotnet-install.sh -Channel 2.1 -InstallDir /opt/dotnet export PATH=$PATH:/opt/dotnet ./dotnet --info
yum -y install zip unzip yum -y install lrzsz
#部署网站 mkdir /app cd /app mkdir BandServer
#使用rz指令上传网站压缩包,使用unzip解压,注意压缩包的相对目录 #unzip publish.zip #添加防火墙 firewall-cmd --zone=public --add-port=3415/tcp --permanent firewall-cmd --reload
#启动网站观察是否工作正常 dotnet BandServer.dll
#配置守护进程
yum -y install python-setuptools easy_install supervisor supervisord --version
echo_supervisord_conf > /etc/supervisord.conf
#编辑supervisord.conf在末尾添加应用(如下,记得去除#) # [program:bandserver] # directory=/app/BandServer # command=/opt/dotnet/dotnet BandServer.dll # autostart=true # autorestart=true # stderr_logfile=/var/log/bandserver.err.log # stdout_logfile=/var/log/bandserver.out.log # user=root # stopsignal=INT # redirect_stderr=true
#设置为开机执行 # vi /etc/rc.local #添加 supervisord -c /etc/supervisord.conf #chmod +x /etc/rc.local systemctl enable rc-local #手动启动守护 supervisord -c /etc/supervisord.conf supervisorctl start all supervisorctl status
#重启 # reboot |
Jexus部署Asp.Net Core项目
参考 https://blog.csdn.net/u010584641/article/details/73611223
使用IIS承载
参考 https://www.cnblogs.com/jasonduan/p/9193702.html