I'm trying to host an ASP.NET Core application in IIS on my local machine, and I'm getting a 502.5 error. My question is different from "ASP.NET Core 1.0 on IIS error 502.5" because I'm not publishing my app, but (for testing purposes) trying to have IIS (not express) on my dev machine serve up the app.
To reproduce:
- Open VS2017
- Create a new
ASP.NET Core Web Application (.NET Core) Choose the "Web API" template and target "ASP.NET Core 1.1" (no authentication)
Your
Mainlooks like this now:public static void Main(string[] args) { var host = new WebHostBuilder() .UseKestrel() .UseContentRoot(Directory.GetCurrentDirectory()) .UseIISIntegration() .UseStartup<Startup>() .UseApplicationInsights() .Build(); host.Run(); }Your csproj looks like this:
<Project Sdk="Microsoft.NET.Sdk.Web"> <PropertyGroup> <TargetFramework>netcoreapp1.1</TargetFramework> </PropertyGroup> <ItemGroup> <Folder Include="wwwroot\" /> </ItemGroup> <ItemGroup> <PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.0.0" /> <PackageReference Include="Microsoft.AspNetCore" Version="1.1.2" /> <PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.3" /> <PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.1.2" /> </ItemGroup> <ItemGroup> <DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="1.0.1" /> </ItemGroup> </Project>Hit F5 to run and
localhost:6565/api/valuesopen up- Add a "Web Configuration File" to the root of the project
Uncomment the
system.webServersection looking like this:<system.webServer> <handlers> <remove name="aspNetCore"/> <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified"/> </handlers> <aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" /> </system.webServer>Open the IIS Manager GUI
- Choose "Add Website", pick a name and a port, set the path to the folder where the
web.configis located - As per Microsoft's instructions set the Application Pool's ".NET CLR version" to "No Managed Code"
Browse to your new application, e.g.
http://localhost:8089/api/valuesResult: HTTP Error 502.5 - Process Failure
Expected: same result as in step 4.
I've tried to exclude all causes mentioned in the top answer to the other question:
- Set
LocalSystemidentity for the app pool - Check on the console if
dotnet --versionruns (i.e. is available on the PATH)
In addition I've tried a few other things:
- Set
processPathto variations of"%LAUNCHER_PATH%\bin\Debug\netcoreapp1.1\WebApplication1.dll - Set
processPathto point todotnet.exeor its location - Re-read the docs to distill a way to do this.
With ASP.NET MVC applications on the .NET Framework you could just spin up a new Website in full IIS that points to the MVC project's folder and it would "just work".
What do you need to do to get this to work with ASP.NET Core? Is it even possible to get this flow working without publishing?