2
votes

Good morning,

I have developed a new ASP.Net Core website published using VS 2015 which works in preprod when published on on my local IIS but not when published on my company IIS Server. With my IT administrator, we've been through all the different steps listed here: https://docs.microsoft.com/en-us/aspnet/core/publishing/iis and tried the solutions: ASP.NET Core 1.0 on IIS error 502.5

  • Install the ASP.Net core windows hosting bundle 1.1.0 which appears in the modules now
  • Restart IIS
  • Check that dotnet.exe is accessible for the user identity of the Application Pool
  • Check that dotnet.exe is accessible in the PATH settings
  • Check that .UseIISIntegration() is my program.cs

but we still have an error

failed to start process with commandline '"dotnet" .\WebApplication.dll', ErrorCode = '0x80004005 : c0000135.

My Web.config is:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.webServer>
    <handlers>
      <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
    </handlers>
    <aspNetCore processPath="dotnet" arguments=".\WebApplication3.dll" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false" />
  </system.webServer>
</configuration>

My appsettings.json:

{
  "ConnectionStrings": {
    "DefaultConnection": "XXXXXXXXXXXXXXXX"
  },
  "Logging": {
    "IncludeScopes": false,
    "LogLevel": {
      "Default": "Debug",
      "System": "Information",
      "Microsoft": "Information"
    }
  }
}

and my project.json:

    {
  "userSecretsId": "aspnet-WebApplication3-XXX",

  "dependencies": {
    "Microsoft.AspNetCore.Razor.Tools": {
      "version": "1.0.0-preview2-final",
      "type": "build"
    },
    "Microsoft.EntityFrameworkCore.Tools": {
      "version": "1.0.0-preview2-final",
      "type": "build"
    },
    "Microsoft.VisualStudio.Web.CodeGeneration.Tools": {
      "version": "1.0.0-preview2-final",
      "type": "build"
    },
    "Microsoft.VisualStudio.Web.CodeGenerators.Mvc": {
      "version": "1.0.0-preview2-final",
      "type": "build"
    },
    "Microsoft.AspNetCore.Authentication.Cookies": "1.1.0",
    "Microsoft.AspNetCore.Diagnostics": "1.1.0",
    "Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore": "1.1.0",
    "Microsoft.AspNetCore.Identity.EntityFrameworkCore": "1.1.0",
    "Microsoft.AspNetCore.Mvc": "1.1.1",
    "Microsoft.AspNetCore.Routing": "1.1.0",
    "Microsoft.AspNetCore.Server.IISIntegration": "1.1.0",
    "Microsoft.AspNetCore.Server.Kestrel": "1.1.0",
    "Microsoft.AspNetCore.StaticFiles": "1.1.0",
    "Microsoft.EntityFrameworkCore.SqlServer": "1.1.0",
    "Microsoft.EntityFrameworkCore.SqlServer.Design": {
      "version": "1.1.0",
      "type": "build"
    },
    "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.1.0",
    "Microsoft.Extensions.Configuration.Json": "1.1.0",
    "Microsoft.Extensions.Configuration.UserSecrets": "1.1.0",
    "Microsoft.Extensions.Logging": "1.1.0",
    "Microsoft.Extensions.Logging.Console": "1.1.0",
    "Microsoft.Extensions.Logging.Debug": "1.1.0",
    "Microsoft.Extensions.Options.ConfigurationExtensions": "1.1.0",
    "Microsoft.NETCore.App": {
      "version": "1.1.0",
      "type": "platform"
    },
    "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.1.0"
  },

  "tools": {
    "BundlerMinifier.Core": "2.2.306",
    "Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview2-final",
    "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final",
    "Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview2-final",
    "Microsoft.Extensions.SecretManager.Tools": "1.0.0-preview2-final",
    "Microsoft.VisualStudio.Web.CodeGeneration.Tools": {
      "version": "1.0.0-preview2-final",
      "imports": [
        "portable-net45+win8"
      ]
    }
  },

  "frameworks": {
    "netcoreapp1.1": {
      "imports": [
        "dotnet5.6",
        "portable-net45+win8"
      ]
    }
  },

  "buildOptions": {
    "emitEntryPoint": true,
    "preserveCompilationContext": true
  },

  "runtimeOptions": {
    "configProperties": {
      "System.GC.Server": true
    }
  },

  "publishOptions": {
    "include": [
      "wwwroot",
      "**/*.cshtml",
      "appsettings.json",
      "web.config"
    ]
  },
  "scripts": {
    "prepublish": [ "bower install", "dotnet bundle" ],
    "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
  }
}

Would you have other suggestions? What would the c0000135 suggests?

Cheers

Sylvain

2
Did asp.net register to your IIS Server? Is Directory Browsing enabled?Vijunav Vastivch
Thanks @mark-spencer, I tried your tips but no success, i have also updated my app to use Microsoft.NETCore.App 1.1.0 to be in line with the ASP.Net core windows hosting bundle 1.1.0 installed on IIS but still the 502.5 error....Sylvain C.
I would try running the website from the command line using dotnet on that machine also. If that runs then you have a problem with the net framework or permissions on your machine.Muqeet Khan

2 Answers

0
votes

I had the same error, fixed by installing Microsoft Visual C++ 2015 Redistributable Update 3.

After that I got another error:

Failed to load the dll from [?9], HRESULT: 0x80070057

The library hostfxr.dll was found, but loading it from C:\Program Files\dotnet\host\fxr\2.0.7\hostfxr.dll failed

Installed KB2999226 and KB3118401 - it did not help. I use Windows Server 2008 R2.

Prerequisites for .NET Core on Windows

0
votes

To solve it I added these lines to the .csproj file

<PropertyGroup>
       <PublishWithAspNetCoreTargetManifest>false</PublishWithAspNetCoreTargetManifest>
</PropertyGroup>

This works for me.