Skip to content

Commit

Permalink
Add note to C-core migration about non-ASP.NET Core SDKs (#30415)
Browse files Browse the repository at this point in the history
Co-authored-by: Rick Anderson <[email protected]>
  • Loading branch information
JamesNK and Rick-Anderson authored Sep 22, 2023
1 parent 3ae317b commit c802e78
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions aspnetcore/grpc/aspnetcore.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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:
Expand Down
8 changes: 8 additions & 0 deletions aspnetcore/grpc/migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

0 comments on commit c802e78

Please sign in to comment.