Skip to content

JanneMattila/wpf-goes-grpc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WPF goes gRPC

Example WPF application which calls backend gRPC server.

Build Status

Build Status

License: MIT

Instructions

Important notice about certificates

In order for Kestrel to work correctly with gRPC and HTTP/2 you need to have TLS certificate set. For demo purposes this example has grpcbackend.pfx certificate bundled directly into the project.

How to create image locally

# Build container image
cd src/Backend
docker build . -t grpcbackend:latest

# Run container using command
docker run -p "20001:443" grpcbackend:latest

How to test locally

Run WPF application named Frontend from the solution. Update backend service address in the top most textbox and invoke any of the gRPC commands.

How to deploy to Azure Container Instances (ACI)

Deploy published image to Azure Container Instances (ACI) the Azure CLI way:

# Variables
aciName="grpc"
resourceGroup="grpc-dev-rg"
location="westeurope"
image="jannemattila/grpcbackend:latest"

# Login to Azure
az login

# *Explicitly* select your working context
az account set --subscription <YourSubscriptionName>

# Create new resource group
az group create --name $resourceGroup --location $location

# Create ACI
az container create --name $aciName --image $image --resource-group $resourceGroup --ip-address public --ports 443

# Show the properties
az container show --name $aciName --resource-group $resourceGroup

# Show the logs
az container logs --name $aciName --resource-group $resourceGroup

# Wipe out the resources
az group delete --name $resourceGroup -y

Deploy published image to Azure Container Instances (ACI) the Azure PowerShell way:

# Variables
$aciName="grpc"
$resourceGroup="grpc-dev-rg"
$location="westeurope"
$image="jannemattila/grpcbackend:latest"

# Login to Azure
Login-AzAccount

# *Explicitly* select your working context
Select-AzSubscription -SubscriptionName <YourSubscriptionName>

# Create new resource group
New-AzResourceGroup -Name $resourceGroup -Location $location

# Create ACI
New-AzContainerGroup -Name $aciName -Image $image -ResourceGroupName $resourceGroup -IpAddressType Public -Port 443

# Show the properties
Get-AzContainerGroup -Name $aciName -ResourceGroupName $resourceGroup

# Show the logs
Get-AzContainerInstanceLog -ContainerGroupName $aciName -ResourceGroupName $resourceGroup

# Wipe out the resources
Remove-AzResourceGroup -Name $resourceGroup -Force

Releases

No releases published

Packages

No packages published