Level Up Coding

Coding tutorials and news. The developer homepage gitconnected.com && skilled.dev && levelup.dev

Follow publication

Member-only story

The Definitive guide to get ASP.NET Grpc Services working on Azure App Service

#hope
Level Up Coding
Published in
3 min readFeb 23, 2025

A few months ago, if you had tried to create a Grpc service on ASP.NET, you would have been hard-pressed to get it working. Now, with ChatGPT and GitHub copilot, creating a Grpc service using ASP.NET and Visual Studio has never been easier.

The hard part is deploying to Azure. I should know because I have been trying to do this for about a week or two.

Let me start by saying — it won’t work with App Service hosted on Windows. Even if you follow everything with ChatGPT, MSDN, and everyone else says — it just does not work. I tried it all.

To get it to work, you have to deploy it to Azure App Service hosted on Linux. This means it must not be a Windows-specific build.

Here is the code which I know works:

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddGrpc();

var app = builder.Build();

app.MapGrpcService<GreeterService>();

app.Run();

Yes, this is taken from the example on MSDN. But know that this will work with all the ASP.NET things you need if you set up authentication talking to a SQL Server database.

Here are the nuget packages I needed:

<ItemGroup>
<PackageReference Include="Grpc.AspNetCore" />
<PackageReference Include="Grpc.AspNetCore.HealthChecks" />
<PackageReference Include="Grpc.AspNetCore.Server" />
<PackageReference Include="Grpc.AspNetCore.Web" />
<PackageReference Include="Microsoft.AspNetCore.ApiAuthorization.IdentityServer" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" />
<PackageReference Include="Microsoft.AspNetCore.Grpc.Swagger" />
<PackageReference Include="Microsoft.AspNetCore.Html.Abstractions" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>

Create an account to read the full story.

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Or, continue in mobile web

Already have an account? Sign in

Written by #hope

“If you see something that’s not right, not fair, not just, do something about it. Say something. Do something.” — Rep. John Lewis

No responses yet

Write a response