{"record":{"id":"e5028c91245d7077","repo":"dotnet/yarp","slug":"typeof-ihttpsysrequestdelegationfeature-fullname","errorCode":null,"errorMessage":"{typeof(IHttpSysRequestDelegationFeature).FullName} is not available. Http.sys delegation is only supported when using the Http.sys server","messagePattern":"(.+?) is not available\\. Http\\.sys delegation is only supported when using the Http\\.sys server","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"critical","filePath":"src/ReverseProxy/Delegation/AppBuilderDelegationExtensions.cs","lineNumber":29,"sourceCode":"\n/// <summary>\n/// Extensions for adding delegation middleware to the pipeline.\n/// </summary>\npublic static class AppBuilderDelegationExtensions\n{\n    /// <summary>\n    /// Adds middleware to check if the selected destination should use Http.sys delegation.\n    /// If so, the request is delegated to the destination queue instead of being proxied over HTTP.\n    /// This should be placed after load balancing and passive health checks.\n    /// </summary>\n    /// <remarks>\n    /// This middleware only works with the ASP.NET Core Http.sys server implementation.\n    /// </remarks>\n    public static IReverseProxyApplicationBuilder UseHttpSysDelegation(this IReverseProxyApplicationBuilder builder)\n    {\n        // IServerDelegationFeature isn't added to DI https://github.com/dotnet/aspnetcore/issues/40043\n        _ = builder.ApplicationServices.GetRequiredService<IServer>().Features?.Get<IServerDelegationFeature>()\n            ?? throw new NotSupportedException($\"{typeof(IHttpSysRequestDelegationFeature).FullName} is not available. Http.sys delegation is only supported when using the Http.sys server\");\n\n        builder.UseMiddleware<HttpSysDelegatorMiddleware>();\n        return builder;\n    }\n}\n","sourceCodeStart":11,"sourceCodeEnd":35,"githubUrl":"https://github.com/dotnet/yarp/blob/bd11867bee7df522e7fd3effb08a9c85fd616908/src/ReverseProxy/Delegation/AppBuilderDelegationExtensions.cs#L11-L35","documentation":"Thrown by UseHttpSysDelegation extension when the IServerDelegationFeature is not present on the server's features. Http.sys request delegation only works with the ASP.NET Core Http.sys server; the feature is not registered by Kestrel or other servers. The extension probes for the feature at app-build time to fail fast rather than at first delegated request.","triggerScenarios":"Calling UseHttpSysDelegation(builder) when the app is hosted on Kestrel (or any non-Http.sys server), so IServer.Features.Get<IServerDelegationFeature>() returns null.","commonSituations":"Developing on Linux/macOS where Http.sys is unavailable (Windows-only). Using Kestrel by default but enabling delegation middleware unconditionally. Copying Windows-only sample code to a cross-platform deployment.","solutions":["Switch the host to Http.sys (UseHttpSys() instead of UseKestrel()) on Windows.","Guard the UseHttpSysDelegation call with an OS/server check so it only applies on Windows with Http.sys.","Remove the delegation middleware if Http.sys delegation is not a deployment requirement."],"exampleFix":"// before — Kestrel + delegation (throws)\nbuilder.WebHost.UseKestrel();\napp.MapReverseProxy(p => p.UseHttpSysDelegation());\n// after — Http.sys on Windows\nbuilder.WebHost.UseHttpSys();\napp.MapReverseProxy(p => p.UseHttpSysDelegation());","handlingStrategy":"type-guard","validationCode":"if (!OperatingSystem.IsWindows())\n    throw new PlatformNotSupportedException(\"Http.sys delegation requires Windows.\");\nvar feat = builder.ApplicationServices.GetRequiredService<IServer>().Features?.Get<IServerDelegationFeature>();\nif (feat is null) throw new NotSupportedException(\"Use Http.sys server for delegation.\");","typeGuard":"static bool SupportsHttpSysDelegation(IWebHostBuilder b) =>\n    OperatingSystem.IsWindows() &&\n    b.Build().Services.GetRequiredService<IServer>().Features.Get<IServerDelegationFeature>() is not null;","tryCatchPattern":"try { app.UseHttpSysDelegation(); }\ncatch (NotSupportedException ex) when (ex.Message.Contains(\"Http.sys\"))\n{ logger.LogWarning(ex, \"Http.sys delegation disabled; not on Http.sys server.\"); }","preventionTips":["Only enable Http.sys delegation on Windows with UseHttpSys().","Guard platform-specific middleware with OS checks.","Document Windows-only features in deployment guides."],"tags":["httpsys","delegation","server","windows","platform","startup"],"backgroundTag":null,"analyzedSha":"bd11867bee7df522e7fd3effb08a9c85fd616908","analyzedAt":"2026-08-13T21:29:49.359Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}