Aspnetcore: Console output is not visible in visual studio when using AspNetCoreHostingModel set to InProcess

Created on 11 Jan 2019  路  15Comments  路  Source: dotnet/aspnetcore

Describe the bug

The output of the web application is no longer visible in the output of visual studio (ASP.NET Core Web Server) when using InProcess IIS hosting (webapp.csproj => InProcess)

To Reproduce

Steps to reproduce the behavior:

  1. Create a new asp.net core web application in visual studio
  2. By default AspNetCoreHostingModel is set to InProcess in the csproj
  3. Execute the web app
  4. There is no entry available in output to see ASP.NET Core Web Server output

Expected behavior

The ASP.NET Core Web Server output should be available and we should see the output log of the web app

Additional context

I am using asp.net core 2.2.1
If I change the value of AspNetCoreHostingModel to OutOfProcess, everything works as expected

area-servers servers-iis

Most helpful comment

@yepeekai still not working with 16.1.5

As a workaround you can modify the project properties, navigate to Debug, select the 脤IS Express profile and select Out Of Process as hosting model. It's a change that is local for your machine so you will be still running InProcess in production.

image

All 15 comments

Can you check the Output window "Show output from: Debug"?

yes that works when you start debugging the web application. Thanks for that workaround. But this doesn't work when not in debug as it used to when using outofprocess...

@BillHiebert @vijayrkn Thoughts on this?

@muratg whenrun out of process, Visual Studio inserts a "shim" process between IIS and the users application, The shim starts the user process, connects to stderr\stdout and redirects it to a pipe opened by VS. Inprocess does not have the shim process so it doesn't pick up up the outputs. Since we start the IIS Express process, we could look into grabbing its output and showing it in the window..

I think piping the output of iisexpress would just "work". We do it in functional tests today.

Out of curiosity, is this issue gonna be resolved in the upcomming asp.net core 3 release?

It is fixed in the next preview of VS 2019.

What about VS2017? 馃槙

EDIT:

Found a workaround:

https://www.nuget.org/packages/Serilog.Sinks.Debug/

            Log.Logger = new LoggerConfiguration()
                .MinimumLevel.Information()
                .Enrich.FromLogContext()
                .WriteTo.Console()
                .WriteTo.Debug()
                .CreateLogger();

I tried it again today with visual studio 2019 16.0.3 and it only shows:
Request started: "Get" ...andRequest ended: ...
I tried to add the serilog.sinks.debug without any success.

@yepeekai still not working with 16.1.5

As a workaround you can modify the project properties, navigate to Debug, select the 脤IS Express profile and select Out Of Process as hosting model. It's a change that is local for your machine so you will be still running InProcess in production.

image

@BillHiebert Still not fixed in VS 2019 16.1.6. This is a bit of a drag on debugging if InProcess is specifically required (Debug is a workaround). Any thoughts on resolution?

@fragilerus this should be working in that build. I assume you are using IIS Express for hosting?

@BillHiebert I believe this is still an issue with 2.2. I have a proposed fix here: https://github.com/aspnet/AspNetCore/pull/10084, but we haven't patched it yet.

This, however, does work in 3.0.

3.0 is out and we updated to it and it works.

Was this page helpful?
0 / 5 - 0 ratings