AspNetKatana icon indicating copy to clipboard operation
AspNetKatana copied to clipboard

owin.RequestId always empty guid string

Open luiz-soares opened this issue 1 year ago • 3 comments

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

luiz-soares avatar Feb 02 '24 13:02 luiz-soares

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

Tratcher avatar Feb 02 '24 16:02 Tratcher

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

image

luiz-soares avatar Feb 02 '24 16:02 luiz-soares

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.

Tratcher avatar Feb 07 '24 18:02 Tratcher