title: asp.net core HTTP Error 503. The service is unavailable
body: <p>The event viewer shows the following errors</p>
  <blockquote>
  <p>The worker process failed to pre-load .Net Runtime version No Managed Code.</p>
  </blockquote>
  <blockquote>
  <p>The worker process failed to initialize correctly and therefore could not be started.  The data is the error.</p>
  </blockquote>
  <p>I am able to run <code>dotnet website.dll</code> from the command line and view it in the web browser, but for some reason IIS does not run the asp.net core website.</p>
  <p>I have installed the windows hosting dotnet core from here as well as the sdk</p>
  <p><a href="https://github.com/dotnet/core/blob/master/release-notes/download-archives/" rel="nofollow noreferrer">https://github.com/dotnet/core/blob/master/release-notes/download-archives/</a></p>
  <p>I have set the .net clr version to &quot;No Managed Code.&quot;</p>
  <p>I changed the identity to Administrator to eliminate potential permission issues</p>
  <pre><code>Enable-WindowsOptionalFeature -Online -FeatureName IIS-WebServerRole
  Enable-WindowsOptionalFeature -Online -FeatureName IIS-WebServer
  Enable-WindowsOptionalFeature -Online -FeatureName IIS-CommonHttpFeatures
  Enable-WindowsOptionalFeature -Online -FeatureName IIS-HttpErrors
  Enable-WindowsOptionalFeature -Online -FeatureName IIS-HttpRedirect
  Enable-WindowsOptionalFeature -Online -FeatureName IIS-ApplicationDevelopment
  Enable-WindowsOptionalFeature -Online -FeatureName NetFx4Extended-ASPNET45
  Enable-WindowsOptionalFeature -Online -FeatureName IIS-HealthAndDiagnostics
  Enable-WindowsOptionalFeature -Online -FeatureName IIS-HttpLogging
  Enable-WindowsOptionalFeature -Online -FeatureName IIS-LoggingLibraries
  Enable-WindowsOptionalFeature -Online -FeatureName IIS-RequestMonitor
  Enable-WindowsOptionalFeature -Online -FeatureName IIS-HttpTracing
  Enable-WindowsOptionalFeature -Online -FeatureName IIS-Security
  Enable-WindowsOptionalFeature -Online -FeatureName IIS-RequestFiltering
  Enable-WindowsOptionalFeature -Online -FeatureName IIS-Performance
  Enable-WindowsOptionalFeature -Online -FeatureName IIS-WebServerManagementTools
  Enable-WindowsOptionalFeature -Online -FeatureName IIS-IIS6ManagementCompatibility
  Enable-WindowsOptionalFeature -Online -FeatureName IIS-Metabase
  Enable-WindowsOptionalFeature -Online -FeatureName IIS-ManagementConsole
  Enable-WindowsOptionalFeature -Online -FeatureName IIS-BasicAuthentication
  Enable-WindowsOptionalFeature -Online -FeatureName IIS-WindowsAuthentication
  Enable-WindowsOptionalFeature -Online -FeatureName IIS-StaticContent
  Enable-WindowsOptionalFeature -Online -FeatureName IIS-DefaultDocument
  Enable-WindowsOptionalFeature -Online -FeatureName IIS-WebSockets
  Enable-WindowsOptionalFeature -Online -FeatureName IIS-ApplicationInit
  Enable-WindowsOptionalFeature -Online -FeatureName IIS-NetFxExtensibility45
  Enable-WindowsOptionalFeature -Online -FeatureName IIS-ASPNET45
  Enable-WindowsOptionalFeature -Online -FeatureName IIS-ISAPIExtensions
  Enable-WindowsOptionalFeature -Online -FeatureName IIS-ISAPIFilter
  Enable-WindowsOptionalFeature -Online -FeatureName IIS-HttpCompressionStatic
  </code></pre>
  <p>Also, I had to change the <code>.csproj</code> to the following to get around conflicting asp.net core versions</p>
  <pre class="lang-xml prettyprint-override"><code>&lt;PropertyGroup&gt;
      &lt;TargetFramework&gt;netcoreapp2.0&lt;/TargetFramework&gt;
      &lt;PublishWithAspNetCoreTargetManifest&gt;false&lt;/PublishWithAspNetCoreTargetManifest&gt;
  &lt;/PropertyGroup&gt;
  </code></pre>