0

I'm getting this error when deploying my ASP.NET Core web app. I have done the following:

  • Enable the Web Server (IIS) role and establish role services.
  • Install the .NET Core Windows Server Hosting bundle v2.0.3
  • Restart the system or execute net stop was /y followed by net start w3svc

Here is my csproj file:

 <Project Sdk="Microsoft.NET.Sdk.Web" ToolsVersion="15.0">

  <PropertyGroup>
    <TargetFramework>netcoreapp1.1</TargetFramework>
    <PreserveCompilationContext>true</PreserveCompilationContext>
    <AssemblyName>MyWebApplication</AssemblyName>
    <OutputType>Exe</OutputType>
    <PackageTargetFallback Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">$(PackageTargetFallback);dotnet5.6;portable-net45+win8</PackageTargetFallback>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="AutoMapper" Version="6.1.1" />
    <PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="2.0.1" />
    <PackageReference Include="Microsoft.AspNetCore" Version="1.1.2" />
    <PackageReference Include="Microsoft.AspNetCore.Authentication.Cookies" Version="1.1.2" />
    <PackageReference Include="Microsoft.AspNetCore.Diagnostics" Version="1.1.2" />
    <PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="1.1.2" />
    <PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.3" />
    <PackageReference Include="Microsoft.AspNetCore.Routing" Version="1.1.2" />
    <PackageReference Include="Microsoft.AspNetCore.Server.IISIntegration" Version="1.1.2" />
    <PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="1.1.2" />
    <PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="1.1.2" />
    <PackageReference Include="Microsoft.EntityFrameworkCore" Version="1.1.2" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="1.1.2" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="1.1.1" />
    <PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="1.1.2" />
    <PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="1.1.2" />
    <PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="1.1.2" />
    <PackageReference Include="Microsoft.Extensions.Logging" Version="1.1.2" />
    <PackageReference Include="Microsoft.Extensions.Logging.Console" Version="1.1.2" />
    <PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.1.2" />
    <PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="1.1.2" />
    <PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink.Loader" Version="14.1.0" />
    <PackageReference Include="System.Runtime.Serialization.Json" Version="4.3.0" />
    <PackageReference Include="Telerik.UI.for.AspNet.Core" Version="2017.2.621" />
  </ItemGroup>

  <PropertyGroup>
   <UserSecretsId>8844d677-223b-4527-a648-387a65933d55</UserSecretsId>
   <ApplicationIcon>wwwroot\favicon.ico</ApplicationIcon>
  </PropertyGroup>

  <ItemGroup>
    <DotNetCliToolReference Include="BundlerMinifier.Core" Version="2.2.301" />
  </ItemGroup>

  <PropertyGroup Label="Globals">
    <SccProjectName>SAK</SccProjectName>
    <SccProvider>SAK</SccProvider>
    <SccAuxPath>SAK</SccAuxPath>
    <SccLocalPath>SAK</SccLocalPath>
    <Version>1.0.0</Version>
  </PropertyGroup>

  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
    <DefineConstants>$(DefineConstants);RELEASE</DefineConstants>
  </PropertyGroup>

</Project>

Here is my web.config file:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <!--
    Configure your application settings in appsettings.json. Learn more at https://go.microsoft.com/fwlink/?LinkId=786380
  -->
  <system.webServer>
    <handlers>
      <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
    </handlers>
    <aspNetCore processPath="C:\Program Files\dotnet\dotnet.exe" arguments=".\MyWebApplication.dll" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false" />
  </system.webServer>
</configuration>

I get this error in my Event Viewer:

Application 'MACHINE/WEBROOT/APPHOST/WWW.MYWEBAPP.COM' with physical root 'C:\inetpub\www.mywebapp.com\' failed to start process with commandline 'dotnet .\mywebapplication.dll', ErrorCode = '0x80004005 : 80008083.

Jean-François Beaulieu
  • 4,305
  • 22
  • 74
  • 107

2 Answers2

3

Most likely, you're missing the Visual C++ 2015 Runtime (available here). The hosting package attempts to download and install this during installation, but if there's a network issue or the server isn't able to connect outside (common in Enterprise environments), then it fails, and you'll need to install it manually with the redistributable.

I can't recall whether it was required or not the last time I hit this issue, but you may want to restart your server again, afterwards, just in case.

EDIT

If you're still having issues, try running your app from the command line via:

dotnet MyApp.dll

This will let you see any exceptions being raised at startup.

If you get an error like:

It was not possible to find any compatible framework version ...

Make sure you have the specific runtime for the version of ASP.NET Core your application is targeting. At the moment, that's either 2.0.3 (for all 2.X apps) or LTS 1.1.5 (for all 1.X apps). You can find the latest runtimes here.

Chris Pratt
  • 232,153
  • 36
  • 385
  • 444
  • 1
    Run the app directly from the command-line: `dotnet run MyApp.dll`. See if there's any exceptions during startup. – Chris Pratt Nov 29 '17 at 15:25
  • I tried doing that but I got this error: `Couldn't find a project to run. Ensure a project exists in ... or pass the path to the project using --project.` – Jean-François Beaulieu Nov 29 '17 at 15:37
  • That's an odd error. I'm assuming you ran that in the actual directory where that DLL exists. You did actually publish it right? In other words, it's built not just the straight project files? – Chris Pratt Nov 29 '17 at 15:39
  • Correct, it builds, publishes successfully but on run-time I get the 502.5 error – Jean-François Beaulieu Nov 29 '17 at 15:41
  • I've posted an edit with the detailed error I'm getting in Event Viewer... – Jean-François Beaulieu Nov 29 '17 at 15:46
  • Doh. My mistake. It should just be `dotnet MyApp.dll`. You only need the `run` for a project. – Chris Pratt Nov 29 '17 at 15:50
  • Ahhh! Now we're getting somewhere. I saw on this post: https://stackoverflow.com/a/42715861/398499 that `Error code: 0x80004005 means a file missing or can't be accessed. Sub-code: 80008083 appears to be a version conflict.` – Jean-François Beaulieu Nov 29 '17 at 15:52
  • Running `dotnet MyWebApp.dll` returns: `It was not possible to find any compatible framework version The specified framework 'Microsoft.NETCore.App', version '1.1.2' was not found. - Check application dependencies and target a framework version installed at: \ - Alternatively, install the framework version '1.1.2'.` – Jean-François Beaulieu Nov 29 '17 at 15:53
  • There you go. Install the .NET Core LTS 1.1.5 runtime: https://www.microsoft.com/net/download/windows – Chris Pratt Nov 29 '17 at 16:00
  • I installed .NET Core SDK v1.1.2 from here: https://github.com/dotnet/core/blob/master/release-notes/download-archives/1.1.2-download.md and ran again and it works on `localhost:5000` – Jean-François Beaulieu Nov 29 '17 at 16:04
  • Deployed again and getting the same error :( it's working if I run the site manually on the web server but not working on IIS when deployed – Jean-François Beaulieu Nov 29 '17 at 16:08
  • Could it be that the .NET Core Windows Server Hosting bundle version does not match the .NET Core SDK version? – Jean-François Beaulieu Nov 29 '17 at 16:12
  • No, the hosting part shouldn't matter. It's just that the 2.0.3 hosting bundle only installs the 2.0.3 runtime, so if you're running 1.1, you need to install that separately. I'd try installing the actual runtime, not the SDK: https://www.microsoft.com/net/download/windows. Get the LTS 1.1.5 version. – Chris Pratt Nov 29 '17 at 16:15
  • Errr... I meant the .NET Core Runtime, not SDK... ok trying that :P – Jean-François Beaulieu Nov 29 '17 at 16:16
  • You'll likely need to reboot the server or complete stop and start the web services, again, just like after installing the hosting bundle. – Chris Pratt Nov 29 '17 at 16:18
0

I found same problem but my target frame work is netcoreapp2.0 and I solved it by using Self-contained deployment without third-party dependencies per Microsoft document following. I used use the target frame work netcoreapp1.0 also and it can solve by using same methodology.

See here solution

KHACHORNCHIT
  • 2,222
  • 23
  • 19