vs2022运行WCF,System.BadImageFormatException

System.BadImageFormatException

HResult=0x80131058
Message=Could not load file or assembly 'System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. Reference assemblies should not be loaded for execution. They can only be loaded in the Reflection-only loader context. (0x80131058)
Source=<无法计算异常源>
StackTrace:
<无法计算异常堆栈跟踪>

内部异常 1:
BadImageFormatException: Cannot load a reference assembly for execution.

 

 

 

出现这个的原因,是因为目标框架的问题;

修改目标框架即可(如下图):

 

posted @ 2022-02-27 19:26  艾特-天空之海  阅读(722)  评论(0编辑  收藏  举报