Problems running / publishing WEP API on IIS10!

1

I want to publish my ASP.NET Web API via filesystem , but I'm having an assembly error while running the site in IIS10.

By VS I can run, but not by IIS.

NOTE: I already have the DLL in the bin folder.

Error:

  

Could not load file or assembly 'Microsoft.CodeDom.Providers.DotNetCompilerPlatform ...

    
asked by anonymous 10.08.2017 / 20:44

1 answer

1

Who uses Roslyn for publication

If your project has Roslyn references and you are interested in posting it to an ISS server , you will probably experience unwanted errors on your website since many ISPs hosting have not yet updated their servers and consequently do not support Roslyn.

To resolve this issue, you will have to remove the Roslyn compiler from the project . Removing Roslyn should not affect the functionality of your code. It worked quietly for me and in other projects (C # 4.5.2) that I worked on.

Perform the following steps:

  • Remove the following Nuget packages by using the command line below () or you can use the Nuget Package manager by right-clicking the Root of your Project's Solution and removing them ).

    PM> Uninstall-package Microsoft.CodeDom.Providers.DotNetCompilerPlatform
    PM> Uninstall-package Microsoft.Net.Compilers
    
  • Remove the following code from the Web.Config file. Use this method only if step 1 does not solve your problem.

    <system.codedom>
    <compilers>
      <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" />
      <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=\&quot;Web\&quot; /optionInfer+" />
    </compilers>
    

  • Restart your IIS and your issue should be resolved.

    Translated and adapted from IIS publishing problems .

        
    11.08.2017 / 13:47