Add note to C-core migration about non-ASP.NET Core SDKs (#30415)

Co-authored-by: Rick Anderson <3605364+Rick-Anderson@users.noreply.github.com>
pull/30420/head
James Newton-King 2023-09-22 09:39:49 +08:00 committed by GitHub
parent 3ae317b9de
commit c802e787f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 0 deletions

View File

@ -260,6 +260,7 @@ You can add a gRPC server to non-ASP.NET Core projects with the following projec
The preceding project file:
* Doesn't use `Microsoft.NET.SDK.Web` as the SDK.
* Adds a framework reference to `Microsoft.AspNetCore.App`.
* The framework reference allows non-ASP.NET Core apps, such as Windows Services, WPF apps, or WinForms apps to use ASP.NET Core APIs.
* The app can now use ASP.NET Core APIs to start an ASP.NET Core server.
@ -268,6 +269,7 @@ The preceding project file:
* `.proto` file.
For more information about using the `Microsoft.AspNetCore.App` framework reference, see [Use the ASP.NET Core shared framework](xref:fundamentals/target-aspnetcore#use-the-aspnet-core-shared-framework).
## Integration with ASP.NET Core APIs
gRPC services have full access to the ASP.NET Core features such as [Dependency Injection](xref:fundamentals/dependency-injection) (DI) and [Logging](xref:fundamentals/logging/index). For example, the service implementation can resolve a logger service from the DI container via the constructor:

View File

@ -113,6 +113,14 @@ ASP.NET Core [middleware](xref:fundamentals/middleware/index) offers similar fun
For more information on how these features compare to each other, see [gRPC Interceptors versus Middleware](xref:grpc/interceptors#grpc-interceptors-versus-middleware).
## Host gRPC in non-ASP.NET Core projects
A C-core-based server can be added to any project type. gRPC for .NET server requires ASP.NET Core. ASP.NET Core is usually available because the project file specifies `Microsoft.NET.SDK.Web` as the SDK.
A gRPC server can be hosted to non-ASP.NET Core projects by adding `<FrameworkReference Include="Microsoft.AspNetCore.App" />` to a project. The framework reference makes ASP.NET Core APIs available and they can be used to start an ASP.NET Core server.
For more information, see [Host gRPC in non-ASP.NET Core projects](xref:grpc/aspnetcore#host-grpc-in-non-aspnet-core-projects).
## Additional resources
* <xref:grpc/index>