aspnet / AspNetKatana

Microsoft's OWIN implementation, the Katana project
Apache License 2.0
959 stars 331 forks source link

owin.RequestId always empty guid string #520

Open luiz-soares opened 5 months ago

luiz-soares commented 5 months ago

Hi,

We are trying to use owin.RequestId from the environment dictionary, but it's an empty guid all the time, is there anything we are missing?

I understand it's an optional field according to the standard, but I'd expect it to be either not present or have a non-empty value

I also checked using a brand new .NET Framework empty web project like: image

using Microsoft.Owin;
using Owin;
using WebApplication1;

[assembly: OwinStartup(typeof(Startup))]

namespace WebApplication1
{
    public class Startup
    {
        public void Configuration(IAppBuilder appBuilder)
        {
            appBuilder.Use((context, next) =>
            {
                var requestId = context.Environment["owin.RequestId"];
                return next();
            });
        }
    }
}

Thanks

Tratcher commented 5 months ago

That's odd. Can you attach the debugger and step into that call? You should end up here: https://github.com/aspnet/AspNetKatana/blob/ab378cfef173dd88c513fc037dec34c6e96b0178/src/Microsoft.Owin.Host.SystemWeb/OwinCallContext.Environment.cs#L216

luiz-soares commented 5 months ago

This is it running in my machine using IIS Express, got empty guid in IIS10 as well.

image

Tratcher commented 5 months ago

This is coming from IIS, it's not an OWIN specific issue. I'm told the value is only available when ETW tracing is enabled in IIS.