这段时间重操旧业,搞笃NET搞得不亦乐乎。发现有个问题,程序发布以后,同样的程序和配置,在服务器上报错,在开发机正常。
报错的代码是这样的:
The assembly for System.Buffers and System.IO.Pipelines could not be loaded; this usually means a missing assembly binding redirect - try checking this, and adding any that are missing; note that it is not always possible to add this redirects - for example 'azure functions v1'; it looks like you may need to use 'azure functions v2' for that - sorry, but that's out of our control
从中可知,是在连接redis时报错了。
连接另一个redis,还是报错;
将服务器的程序原原本本打包,拿到我自己开发机器上(win10)运行,正常;拿到另一台win7的机器上运行,也正常;
看来是服务器环境的问题。在网上寻寻觅觅,比较dll版本啦,修改web.config啦,都不好使。
后来发现,我机器点net的版本是4.8,另一台win7的是4.7.2,而服务器是4.6.2。将服务器.net升级到4.7.2,问题解决。