title: System.MissingMethodException: Method not found: 'System.String System.CodeDom.Compiler.CompilerParameters.get_CoreAssemblyFileName()'
body: <p>My Asp.Net MVC application is working fine on my machine (IIS). When I deployed this on Windows Server 2008 R2 IIS, I am getting below error:</p>
  
  <pre><code>[MissingMethodException: Method not found: 'System.String System.CodeDom.Compiler.CompilerParameters.get_CoreAssemblyFileName()'.]
     Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCompiler.CmdArgsFromParameters(CompilerParameters parameters) +0
     Microsoft.CodeDom.Providers.DotNetCompilerPlatform.Compiler.GetCompilationArgumentString(CompilerParameters options) +32
     Microsoft.CodeDom.Providers.DotNetCompilerPlatform.Compiler.FromFileBatch(CompilerParameters options, String[] fileNames) +519
     Microsoft.CodeDom.Providers.DotNetCompilerPlatform.Compiler.CompileAssemblyFromFileBatch(CompilerParameters options, String[] fileNames) +192
     System.CodeDom.Compiler.CodeDomProvider.CompileAssemblyFromFile(CompilerParameters options, String[] fileNames) +25
     System.Web.Compilation.AssemblyBuilder.Compile() +961
     System.Web.Compilation.BuildProvidersCompiler.PerformBuild() +222
     System.Web.Compilation.ApplicationBuildProvider.GetGlobalAsaxBuildResult(Boolean isPrecompiledApp) +9202922
     System.Web.Compilation.BuildManager.CompileGlobalAsax() +44
     System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() +265
  
  [HttpException (0x80004005): Method not found: 'System.String System.CodeDom.Compiler.CompilerParameters.get_CoreAssemblyFileName()'.]
     System.Web.Compilation.BuildManager.ReportTopLevelCompilationException() +62
     System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() +421
     System.Web.Compilation.BuildManager.CallAppInitializeMethod() +31
     System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +691
  
  [HttpException (0x80004005): Method not found: 'System.String System.CodeDom.Compiler.CompilerParameters.get_CoreAssemblyFileName()'.]
     System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9172928
     System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +97
     System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +256
  </code></pre>
  
  <p>I have deployed the same application on around 10 different servers (with similar .Net Framework as this) having same configuration and all is working fine. The server has .Net Framework 3.5.1. I have not specified any target framework in Web config file. </p>
  
  <p>I researched a lot and a couple of similar posts suggests to upgrade the .Net Framework to 4.5 but the same application is working fine on other servers with .Net Framework 3.5.1. Below is web config file:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;!--
    For more information on how to configure your ASP.NET application, please visit
    http://go.microsoft.com/fwlink/?LinkId=301880
    --&gt;
  &lt;configuration&gt;
    &lt;configSections&gt;
      &lt;!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --&gt;
      &lt;section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /&gt;
      &lt;!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --&gt;
    &lt;/configSections&gt;
    &lt;connectionStrings&gt;
      &lt;add name="****" connectionString="Data Source=.\SQLExpress; Initial Catalog=***; User ID=**; Password=****;" providerName="System.Data.SqlClient" /&gt;
      &lt;add name="****" connectionString="metadata=res://*/Models.****.csdl|res://*/Models.****.ssdl|res://*/Models.****.msl;provider=System.Data.SqlClient;provider connection string=&amp;quot;data source=.\SQLExpress;initial catalog=****;user id=**;password=****;MultipleActiveResultSets=True;App=EntityFramework&amp;quot;" providerName="System.Data.EntityClient" /&gt;
  
      &lt;/connectionStrings&gt;
    &lt;appSettings&gt;
      &lt;add key="webpages:Version" value="3.0.0.0" /&gt;
      &lt;add key="webpages:Enabled" value="false" /&gt;
      &lt;add key="ClientValidationEnabled" value="true" /&gt;
      &lt;add key="UnobtrusiveJavaScriptEnabled" value="true" /&gt;
    &lt;/appSettings&gt;
    &lt;!--&lt;system.web&gt;
      &lt;compilation debug="true" targetFramework="4.5.2" /&gt;
      &lt;httpRuntime targetFramework="4.5.2" /&gt;
    &lt;/system.web&gt;--&gt;
    &lt;runtime&gt;
      &lt;assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"&gt;
        &lt;dependentAssembly&gt;
          &lt;assemblyIdentity name="Newtonsoft.Json" culture="neutral" publicKeyToken="30ad4fe6b2a6aeed" /&gt;
          &lt;bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" /&gt;
        &lt;/dependentAssembly&gt;
        &lt;dependentAssembly&gt;
          &lt;assemblyIdentity name="System.Web.Optimization" publicKeyToken="31bf3856ad364e35" /&gt;
          &lt;bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="1.1.0.0" /&gt;
        &lt;/dependentAssembly&gt;
        &lt;dependentAssembly&gt;
          &lt;assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" /&gt;
          &lt;bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" /&gt;
        &lt;/dependentAssembly&gt;
        &lt;dependentAssembly&gt;
          &lt;assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" /&gt;
          &lt;bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" /&gt;
        &lt;/dependentAssembly&gt;
        &lt;dependentAssembly&gt;
          &lt;assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" /&gt;
          &lt;bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" /&gt;
        &lt;/dependentAssembly&gt;
        &lt;dependentAssembly&gt;
          &lt;assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" /&gt;
          &lt;bindingRedirect oldVersion="1.0.0.0-5.2.3.0" newVersion="5.2.3.0" /&gt;
        &lt;/dependentAssembly&gt;
      &lt;/assemblyBinding&gt;
    &lt;/runtime&gt;
    &lt;system.codedom&gt;
      &lt;compilers&gt;
        &lt;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" /&gt;
        &lt;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=\&amp;quot;Web\&amp;quot; /optionInfer+" /&gt;
      &lt;/compilers&gt;
    &lt;/system.codedom&gt;
    &lt;entityFramework&gt;
      &lt;defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" /&gt;
      &lt;providers&gt;
        &lt;provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" /&gt;
      &lt;/providers&gt;
    &lt;/entityFramework&gt;
    &lt;system.web&gt;
      &lt;compilation /&gt;
    &lt;/system.web&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>Please advise what I am missing. Thanks.</p>