Search This Blog
Wednesday, November 3, 2021
Tuesday, March 9, 2021
Missing WSMan client and missing liblibpsrpclient in establishing remote sessions using powershell from a docker container
RUN apt-get update \
&& apt-get install --no-install-recommends -y \
# less is required for help in powershell
# requied to setup the locale
# required for SSL
# PowerShell remoting over SSH dependencies
&& apt-get dist-upgrade -y \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
# enable en_US.UTF-8 locale
&& sed -i 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/g' /etc/locale.gen \
# generate locale
&& locale-gen && update-locale
RUN apt-get -y install wget
RUN wget "http://http.us.debian.org/debian/pool/main/g/glibc/multiarch-support_2.19-18+deb8u10_amd64.deb"
RUN dpkg -i multiarch-support_2.19-18+deb8u10_amd64.deb
RUN wget "http://security.debian.org/debian-security/pool/updates/main/o/openssl/libssl1.0.0_1.0.1t-1+deb8u12_amd64.deb"
RUN dpkg -i libssl1.0.0_1.0.1t-1+deb8u12_amd64.deb
#install powershell WSMan.Management module (https://www.bloggingforlogging.com/2020/08/21/wacky-wsman-on-linux/)
RUN pwsh -Command "Install-Module -Name PSWSMan -Force"
RUN pwsh -Command "Install-WSMan"
Sunday, January 10, 2021
Wednesday, December 2, 2020
I am embarrassed but I could not get a working ILogger instance to log to the console. I expected this to be achievable with 3, 4 lines. Tried several different approaches, following different posts/articles, nothing !
Using Serilog, however, gives the desired results, easily.
var serilog = new LoggerConfiguration()
.WriteTo.File("Logs\\tests.txt", rollingInterval: RollingInterval.Day)
var logger = new LoggerFactory().AddSerilog(serilog).CreateLogger<LinuxStartUpAndUpdaterManager>();
For instance, I use the following method in a base class all my test classes inherit from:
protected ILogger<K> GetLogger<K>()
var serilog = new LoggerConfiguration()
.WriteTo.File("testLog.txt", rollingInterval: RollingInterval.Day)
//if you need a Microsoft.Extensions.Logging ILogger out of your serilog
return LoggerFactory.Create((c) =>
Monday, August 31, 2020
Save the following xml file with the .snippet extension.
Afterwards, load it into the Code Snippet Manager in Visual Studio via
Tools -> Code Snippet Manager -> Import
That's it. Type tt + Tab and the code block between CDATA[...] is inserted.
<?xml version="1.0" encoding="utf-8"?>
<Description>Add Unit Test Fact</Description>
public async Task ObjectBeingTested_Action_ExpectedResult()
Monday, August 24, 2020
In Visual Studio 2019, dragging the whole project to an empty class diagram (add new item -> class diagram) will do the job.
Make sure you have the Visual Studio Class Designer component installed.
From Randy Patterson:
.NET Core 3 introduced a new project template called Worker Service. This template is designed to give you a starting point for cross-platform services. As an alternate use case, it sets up a very nice environment for general console applications that is perfect for containers and microservices.
From Steve J Gordon:
The simple answer is – when and if you need them! If you have a requirement to develop a microservice which has no user interface and which performs long-running work, then a worker service is very likely going to be a good fit.
Remember that a worker service is just a console application under the hood. That console application uses a host to turn the application into something which runs until it is signalled to stop. The host brings with it features like dependency injection that you’ll likely already familiar with. Using the same logging and configuration extensions available in ASP.NET Core makes it easy to develop worker services which should log information and which require some configuration. These requirements are nearly always present when building worker services that will run in the cloud. For example, you will likely need to provide configuration for any external services that your worker service will interact with. A queue URL for example.
Worker services can be used to extract responsibilities from existing ASP.NET Core applications (I cover this in my Pluralsight course) and to design new .NET Core based microservices.