CodeDom Provider could not be located on IIS7 - iis

I have added a site on my IIS but when I try to get to the default page, I get the following error :
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=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" could not be located.
Source Error:
Line 12: <system.codedom>
Line 13: <compilers>
Line 14: <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:6 /nowarn:1659;1699;1701" />
Line 15: <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=\"Web\" /optionInfer+" />
Line 16: </compilers>
Do I need to install the "Microsoft.CodeDom.Providers.DotNetCompilerPlatform" package with nuget to make it works or is it something different ?

You can comment out the entire System.CodeDom section from web.config.
WebApplication projects will have the CodeDom section, WebSite projects wont. Comment it out and it should start working.
Source:
http://www.codeproject.com/Questions/1034471/Unable-to-run-ASP-net-pages-on-web-server

Try running inetmgr (IIS) right click your website and Choose Convert to Application.
This worked for me.

Maybe do you have different version compiler? Try - Project > Manage NuGet Packages... > Browse(tab) > in search input set this:
Microsoft.CodeDom.Providers.DotNetCompilerPlatform
You can install or update or uninstall and install this compiler

I solved similar issue by installing updates TOOLS->NuGetPackage Installer MENU -> ALL-> Update especially for Microsoft.CodeDom.Providers.DotNetCompilerPlatform

Similar answer to Bayak, you have settings in WebConfig that are not compatible for your web server. Visual Studio can add alot of extra weight to the file by default. Trim WebConfig to:
<configuration>
<system.web>
<customErrors mode="Off"></customErrors>
<compilation debug="true" targetFramework="4.6.1"/>
<httpRuntime targetFramework="4.6.1"/>
</system.web>
</configuration>

Related

Change config file for Excel Addin

I have created a VSTO Excel Addin in Visual studio. My project included Setting.Settings file and app.config file.
Basically, the Settings.Settings file contains some settings required for the addin, which are based on user preference.
Currently to publish the Excel Addin, I need to build it everytime according to the user requirements by changing values in Settings.Settings file or app.config value.
Is there any way to include App.config file in separate folder while publishing, so that when user runs setup.exe file he can set up the app.config file as per their requirements.
The Settings.Settings file looks like this:
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings"
CurrentProfile="(Default)" GeneratedClassNamespace="ExcelAddinProject.Properties"
GeneratedClassName="Settings">
<Profiles />
<Settings>
<Setting Name="TabLabel" Type="System.String" Scope="User">
<Value Profile="(Default)">Testing</Value>
</Setting>
</Settings>
</SettingsFile>
The app.config file looks like this:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup,
System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="ExcelAddinProject.Properties.Settings"
type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089"
allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
<userSettings>
<ExcelAddinProject.Properties.Settings>
<setting name="TabLabel" serializeAs="String">
<value>Testing</value>
</setting>
</ExcelAddinProject.Properties.Settings>
</userSettings>
</configuration>
After deployment the folder looks like this:
| ApplicationFiles
ExcelAddinProject
ExcelAddinProject.dll.config.deploy
ExcelAddinProject.dll.deploy
ExcelAddinProject.dll.manifest
ExcelAddinProject
Microsoft.Office.Tools.Common.v4.0.Utilities.dll.deploy
Microsoft.Office.Tools.Excel.v4.0.Utilities.dll.deploy
System.Configuration.ConfigurationManager.dll.deploy
System.Security.AccessControl.dll.deploy
System.Security.Permissions.dll.deploy
System.Security.Principal.Windows.dll.deploy
| ExcelAddinProject VSTO
| setup.exe
The ExcelAddinProject.dll.config.deploy contains global configs, which apply to all users using this addin. I want to be able, to change this config after deployment.
So, how can I change this config file after deployment?
I tried MageUI it seems to work, but it's complicated for the customer to do on their own.
Any answers would be great help, I tried finding answers but nothing seems to work.
Thanks

IIS V10.0 in Windows 10 does not recognise anymore customErrors on web.config with 500.19 0x80070032 error

I use IIS 10 on windows 10, I was use to have web.config files with customErrors, but now it is not accepting it anymore. I been procrastinating hotfixing just removing the line from the webconfig, but now I am trying to figure out what is wrong and fix it once and for all.
Error Source:
<system.web>
<customErrors mode="Off"/>
<httpRuntime targetFramework="4.6.2" />
The machine config has <deployment retail="true" />, and whit this configuration if I remove the tag IIS works fine and the web application is served correctly, if I change the retail setting to false, it will break again asking for the customErrors to be set.
I could not find any information online on this specific type of issue, and I tried to follow also the error code investigation path, but it leads to TLS configuration which in my case is correct and enabled.
After lots of digging I found that one of the machine.config (for the current framework4x and architecture x64) had a missing section in the system.web group:
<sectionGroup name="system.web" type="System.Web.Configuration.SystemWebSectionGroup, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<section name="customErrors" type="System.Web.Configuration.CustomErrorsSection, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
I copied the section from the 32 bit version of the machine.config and this fixed the issue.
This documentation about IIS configuration hierarchy helped me:
https://learn.microsoft.com/en-us/iis/get-started/planning-your-iis-architecture/the-configuration-system-in-iis-7#:~:text=%20At%20the%20root%20%28or%20global%29%20level%2C%20there,global%20defaults%20for%20the%20.NET%20framework...%20More%20

Web service giving "could not load file or assembly error"

I just moved a website and related web service from IIS6 to 8.
The website works fine, but the webservice is giving the following error:
Server Error in '/CreditCardService' Application.
Could not load file or assembly 'System.Web.Mvc, Version=3.0.0.1, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
The web service config file do not have any related lines in it.
Only the website web.config has any related lines in it, see below.
<add assembly="System.Web.Mvc, Version=3.0.0.1, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
Any ideas how to resolve this?

SpecFlow + Coded UI - Step Definition Report - Could not load file or assembly

I am not able to extract a Step Definition Report from my project.
The following error occurred:
Could not load file or assembly 'Smoke.Tests, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
Notes:
specflow.exe.config was added with the suggested content:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0.30319" />
</startup>
</configuration>
Target framework: .NET Framework 4
Platform target: Any CPU
The test project is a Coded UI + SpecFlow project
Any suggestion is welcomed. Thanks!

Moving to new server = error

I have a pretty standard Sitecore site (no extra assemblies etc., just some layouts and xslt files). The site is working fine on my own server (old w2003 w/iis6). The site now needs to be moved to a new server (w2008 w/iis7). But the site fails to lad, giving this error;
Could not load file or assembly 'System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
In the following line in the web.config
Line 3176: <add assembly="System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
Any ideas as to what could be wrong? I dont have access to the server myself, but have just been sent a link to the site, where i can see the above error.
It seems that you have MVC dependencies you also have to deploy to a new server. This thread might be helpful.

Resources