如何修复错误 PublicKeyToken=31bf3856ad364e35" 找不到

How to fix the Error PublicKeyToken=31bf3856ad364e35" could not be located

我刚刚在本地服务器上成功编写了 Web 服务 运行,但是当我将 api 上传到 Web 服务器时,出现以下错误。

Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message: The CodeDom provider type "Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" could not be located.

Haris Zafar,您的项目中缺少此基础设施包。

进入工具> NuGet 包管理器> 包管理器控制台并输入此命令:

PM> Install-Package Microsoft.Web.Infrastructure

通过从 NuGet 下载包 Microsoft.CodeDom.Providers.DotNetCompilerPlatform 将其升级到最新版本。