Open khteh opened 2 years ago
@khteh the sample code only supports Startup.cs
and not Program.cs
. We may add support for Program.cs
in the future.
We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.
Isn't the sample code built for .Net 6 and the date of the article is "06/04/2022"?
Hello!!! Wasn't startup.cs
removed in .Net 6 with minimal hosting model? How long should we wait to do integration tests on gRPC services!?!
It isn't removed. Both options are supported. If you need it then you should choose it over WebApplicationBuilder
.
Do we have a doc on how to test with the minimal hosting model?
I am also interested to see how I can test when I don't have a startup class in the gRPC server, but a Program.cs with only top level statements. It seems it is possible for MVC using the WebApplicationFactory.
I tested this for my gRPC test project and found it worked for me:
public partial class Program { }
to the end of Program.cs in the gRPC service project. _appFactory = new WebApplicationFactory<Program>()
.WithWebHostBuilder(builder =>
{
builder.ConfigureServices(services =>
{
services.AddSingleton<ILoggerFactory>(LoggerFactory);
});
});
_channel = GrpcChannel.ForAddress("http://localhost", new GrpcChannelOptions
{
LoggerFactory = _fixture.LoggerFactory,
HttpHandler = _fixture.AppFactory.Server.CreateHandler()
});
_channel
as argument.Any update on this?
Do we have a doc on how to test with the minimal hosting model?
I don't believe so, it would be very useful
Is there an existing issue for this?
Describe the bug
I follow this: https://learn.microsoft.com/en-us/aspnet/core/grpc/test-services?view=aspnetcore-6.0 and bump into:
The server is configured to listen at
https://localhost:5000
. This happens when I use the defaultTestServer.CreateHandler()
.Does .Net Core 6 GRPC support HTTP/3? I configure
HttpHandler
with the following class:and assign it:
and bump into the same error and exception shown above.
Expected Behavior
No response
Steps To Reproduce
No response
Exceptions (if any)
No response
.NET Version
6.0.402
Anything else?
Windows 11, Visual Studio 2022 17.3.6