Install .NET Framework 4.7.2 on Azure Service Fabric nodes

It might be a bit surprising, but if you play with Azure Service Fabric - create a new cluster on Azure and a bare-bones application in Visual Studio - you might end up with errors in Cluster Explorer because the service fails to run on the nodes. I’d expect the out of the box experience to be much better, but that’s what it is right now. And the reason is you’re probably running Visual Studio version which defaults to .NET Framework 4.7.1 or even 4.7.2 and by default these are not installed on VMs underlying an Azure Service Fabric cluster! In this post I’ll show you how to fix it using Custom Script VM Extension.

Read More

ASP.NET Core configuration when running as Service Fabric service

When you create an ASP.NET Core Stateless Service for Service Fabric an appsettings.json file is added automatically as part of the project template. It might surprise you, but if you run the template service the settings from that file won’t be available for you to use in the code! In this post I’ll show you how to make the service respect that file and allow you access the config values from it. I’ll also talk about the difference between loading the appsettings.json file from Code or Config package and why you might care.

Read More

Microsoft Build 2018 - Day 1

I’m attending Microsoft Build conference this year! I’ve been wanting to go to //Build for a long time now and this year it finally happened. I figured I’d share my perspective on all the things that were announced today as well as some thoughts on certain sessions I went to and the conference in general.

Read More

RSA APIs in .NET - Performance comparison

I the last few days I had to take a closer look at cryptographic APIs available in .NET Framework. We’re using RSA + SHA256 to give Office Online hosts opportunity to validate that a request we’re making is actually coming from us. We call that Proof Keys and you can read more about it in public documentation on Office Online Integration Documentation. Just recently we’ve noticed interesting performance problems around signing the data before we make the requests.

.NET had always had RSAServiceCryptoProvider and that’s what we were using. However, when .NET 4.6 shipped a new set of APIs was added, including RSACng. This new RSA Api is backed by Cryptography API: Next Generation in Windows. Turns out that new API is not just easier to use but also much faster.

Read More

Calling a synchronous WCF method asynchronously using ChannelFactory

Asynchronous operation contracts in WCF have been supported since .NET 4.5: you can define service methods to return Task or Task<T> and as you implement your service logic you can use async/await to do the right things when it comes to using IO or other asynchronous operation. You can also use older paradigm called Asynchronous Programming Model (APM) which is based on a pair of Begin*/End* methods.

On the consumer side you can use Visual Studio’s “Add Service Reference” option to generate a client or use ChannelFactory and the service interface to make the calls. All that sounds pretty great, until you run into a situation I recently run into: you have a WCF service which has method you want to implement asynchronously, but you also have some legacy client which for a valid reason has to make the calls in synchronous way. In this post I’ll show you how to call asynchronous WCF operation synchronously (or the other way around) using ChannelFactory.

Read More