How to fix configuration error 'The CodeDom provider type could not be located' and parsing error 'Could not load type' leading to each other?
Asked Answered
M

7

6

I'm currently working on a project, that includes ASP.net, JS, C#, Html and etc. My project was working fine and had no problem to load whats so ever and neither had any problems running using IIS express (10.0). I added a few more classes and edited a web form, and when I tried to run the code in order to check my work, I had the 'Server Error in '/' Application. Configuration Error' thrown.

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

when I tried searching for a solution, I've found a few, but they all led me to a "Parser error", 'Could not load type'.

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

No matter what method nor approach I'm trying to use in order to solve any of these problems, I always seem to get back to the second one... Could anyone please help?

Manifesto answered 2/6, 2020 at 19:40 Comment(2)
Do you have finally resolved your problem ?Sundae
did you end up fixing it? i've got it too ... and after an hour of searching, cannot find the solutionUnclassical
S
13

It's likely because you have

<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>

in your Web.config file but the Microsoft.CodeDom.Providers.DotNetCompilerPlatform package is not installed in the project. Check your project package references to see if the package is installed. If it's not, go to Nuget Package Manager and install Microsoft.CodeDom.Providers.DotNetCompilerPlatform.

Stoller answered 24/2, 2021 at 15:45 Comment(0)
T
4

Ensure that the /bin folder is not empty. It should contain all .dll files after build

Tope answered 19/9, 2020 at 2:33 Comment(0)
L
4

I had the project properties Build -> Output path set to bin\Debug. The DLLs were copied into this folder upon cleaning and rebuilding the solution but still I was getting this error. After changing the output path to bin\ and rebuilding the solution it worked on the localhost. Then I changed the properties to set the Build output path back to \bin\Debug\ and rebuilt the solution and it worked fine.

Lioness answered 30/10, 2021 at 13:16 Comment(0)
A
1

This may be specific to me, but I was adding a webservice that was in a folder under the main application folder. I had to go into IIS and create a virtual application to this folder. I THINK that causes IIS to ignore web.config files "above" this folder and use the web.config file for this "application". Maybe that will help someone who is searching like I was. In my case I had another web service structured identically and I could not figure out why one worked and the other did not.

Arsenic answered 8/8, 2022 at 6:19 Comment(0)
F
0

If you still have such problem

  1. Add NETStandard.Library nuget to your project.
  2. Add the following line to your web.config:
<system.web>
    <compilation debug="true" targetFramework="4.8">
      <assemblies>
        <!-- ADD THIS LINE BELLOW -->
        <add assembly="netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51" />
      </assemblies>
    </compilation>
Fungosity answered 17/5, 2022 at 17:48 Comment(0)
D
0

The error means that you don't have all the dll files required for the project.

In my case I just uploading the bin folder to my hosting directory because it is not uploaded, so I uploaded bin folder manually and it worked. MA

Doublestop answered 17/6, 2022 at 18:49 Comment(0)
R
0

Make sure you're pointing to the correct path, for the app, in IIS Basic Settings

Randarandal answered 3/4, 2024 at 21:31 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.