-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update giraffe sample to .NET 6 alpha #6891
Conversation
a31d507
to
c726a94
Compare
this one is ready |
|> ignore) | ||
.Build() | ||
.Run() | ||
let configureApp (appBuilder : IApplicationBuilder) = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Glancing at this, is there anything here that could cause a performance change? UseKestrel being dropped? Anything else?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAIK that's how hosting is initialized in asp.net core 6. /cc @davidfowl
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be a bit more minimal overall:
let builder = WebApplication.CreateBuilder(args)
builder.Services.AddGiraffe()
.AddSingleton(jsonSerializer) |> ignore
let app = builder.Build()
app.UseGiraffe HttpHandlers.endpoints |> ignore
app.Run()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is another PR coming that disables logging. Could this be a change to asp.net core 5 that affected performance? Was logging enabled before?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And thanks for the help!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@davidfowl for the avoidance of doubt, is that because these things are all registered by default:
https://github.com/dotnet/aspnetcore/blob/4226c40df06f1e2edc4576ea2b1c787d69238bb4/src/DefaultBuilder/src/WebApplicationBuilder.cs#L238-L299
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@davidfowl AddRouting could indeed go but removing UseRouting errors with:
Unhandled exception. System.InvalidOperationException: EndpointRoutingMiddleware matches endpoints setup by EndpointMiddleware and so must be added to the request execution pipeline before EndpointMiddleware. Please add EndpointRoutingMiddleware by calling 'IApplicationBuilder.UseRouting' inside the call to 'Configure(...)' in the application startup code.
Are we expected to add this inside the UseGiraffe implementation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change this to MapGiraffeEndpoints instead of UseGiraffe
cc @dustinmoris
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When the EndpointRouting
namespace is open then the UseGiraffe
extension method is doing the correct thing already.
* Update giraffe sample to .NET 6 * Use WebApplication in Giraffe host * Update Npgsql
This updates the Giraffe sample to .NET 6 as soon as Giraffe 6 comes out