gpt4 book ai didi

c# - 如何修复配置错误 'The CodeDom provider type could not be located'和解析错误 'Could not load type'相互导致?

转载 作者:行者123 更新时间:2023-12-04 16:40:15 35 4
gpt4 key购买 nike

我目前正在开发一个项目,其中包括 ASP.net、JS、C#、Html 等。我的项目运行良好,加载任何内容都没有问题,使用 IIS express (10.0) 运行时也没有任何问题。我添加了更多类并编辑了一个 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.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" could not be located.

Source Error:


Line 31: <system.codedom>
Line 32: <compilers>
Line 33: <compiler language="c#;cs;csharp" extension=".cs"
Line 34: type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
Line 35: warningLevel="4" compilerOptions="/langversion:default /nowarn:1659;1699;1701"/>

Source File: C:\Users\Dell\Desktop\School\מדעי המחשב\WebProject\Project\web.config Line: 33

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.8.4075.0



当我尝试寻找解决方案时,我找到了一些,但它们都导致我出现“解析器错误”,“无法加载类型”。

Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: Could not load type 'Project.Global'.

Source Error:


Line 1:  <%@ Application Codebehind="Global.asax.cs" Inherits="Project.Global" Language="C#" %>

Source File: /global.asax Line: 1

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.8.4075.0



无论我尝试使用什么方法或方法来解决这些问题中的任何一个,我似乎总是回到第二个......
有人可以帮忙吗?

最佳答案

这可能是因为你有

<system.codedom>
<compilers>
<compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:6 /nowarn:1659;1699;1701" />
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+" />
</compilers>
</system.codedom>
在您的 Web.config 文件中,但 Microsoft.CodeDom.Providers.DotNetCompilerPlatform 包未安装在项目中。检查您的项目包引用以查看是否安装了该包。如果不是,请转到 Nuget 包管理器并安装 Microsoft.CodeDom.Providers.DotNetCompilerPlatform。

关于c# - 如何修复配置错误 'The CodeDom provider type could not be located'和解析错误 'Could not load type'相互导致?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62160105/

35 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com