Error when reading from PFX certificate SSL/TLS

Establish a secure connection to a server. Authentication with certificate.

Error message
The request was aborted: Could not create SSL/TLS secure channel.

  1. Start Microsoft Management Console, either from control panel or by run command “mmc”.
  2. In MMC select File > Add/Remove Snap-In (Ctrl+M).

    mmc add remove snap in
  3. Select Certificates > Add > OK. In next window select Local Computer.

    mmc add certificate
  4. When Certificates is added select Certificates > Personal > Certificates.
  5. You can see all the installed certificates in the window to the right. In order to add a permission right-click on a certificate and select All Tasks > Manage Private Keys.

    mmc manage private keys
  6. Search for user IIS_IUSRS (IIS User) and then add the user. You can configure the permissions like full control, read etc.
    when the user is added.

    mmc add iis user

Problems connecting to WCF service

Trying to connect to a WCF-service but get some error messages:

The HTTP request is unauthorized with client authentication scheme Anonymous The authentication header received from the server was Basic

The provided URI scheme https is invalid expected http

The solution was to adjust web.config > system.serviceModel section. Add “Transport” to security mode. and clientCredentialType should be “Basic” if the server expects Basic Realm.

        <binding name="Document_Binding" closeTimeout="01:00:00" openTimeout="01:00:00" receiveTimeout="01:00:00" sendTimeout="01:00:00" maxReceivedMessageSize="2147483647">
          <security mode="Transport">
            <transport clientCredentialType="Basic" />
    <endpoint ....../>

Good luck with your connections =)

Unable to connect to SQL DB via SSMS on Azure VM

I’ve installed SQL Server 2016 Express on a Azure Virtual Machine (VM). I opened the ports (port 1433) to connect to the server via Sql Server Management Studio (SSMS) but access was denied. I also opened the port inside the Azure portal on the server but still no success.
Then I came over a solution to the connection problem. You need to set the port number on IPAll among IP Addresses inside TCP/IP in Sql Server Configuration Manager. See screenshot below.

TCP Port 1433

How to navigate to the TCP Port setting:

  1. Open Sql Server Configuration Manager.
  2. Click on “Protocols” for “{INSTANCE NAME}” under Sql Server Network Configuration.
  3. Double click on TCP/IP.
  4. Click on tab “IP Addresses”.
  5. Scroll to the bottom and write the port number (1433 is default).

Good luck!

Copy files using a runtime created batch file C#

If you would like to copy one or several files using a batch file. The command for that is “copy {target} {destination}”. It’s also possible to use wildcards i.e “copy *.txt c:\temp”.
To create a bat (batch) file on runtime and then execute the file you could write something like this in C#.

string batchFileName = @"C:\{filePath}\copy.bat";
System.IO.File.WriteAllText(batFileName, @"copy {fileName}.{extension} {destination-filePath}");

sqlI have a table in Microsoft SQL Server where insert or updates isn’t possible. Table is only responsible to increment a unique id.

The table looks like this:

CREATE TABLE [dbo].[CustomerOrderNumbers](
[customerOrderNumberId] [int] IDENTITY(1,1) NOT NULL,
[createdOn] [datetime] NOT NULL,
[isDeleted] [bit] NOT NULL,
[customerOrderNumberId] ASC

ALTER TABLE [dbo].[CustomerOrderNumbers] ADD DEFAULT (getdate()) FOR [createdOn]

ALTER TABLE [dbo].[CustomerOrderNumbers] ADD DEFAULT ((0)) FOR [isDeleted]

But how do you increase the primary key when you can’t insert any values?

Answer, insert default value:

This command also works with Azure SQL database.

Cordova build APK – Package damaged

I tried to build an APK (Android) in Cordova, build is successful so far so good!
When transferring the file to my mobile I got error message during install “Installation is not possible, package is damaged”. I created a new Cordova project and compared my “config.xml” file with the one in the project that failed. Found out that the “android-versionCode” is causing the problem. This is specified in the top of the config.xml. Remove that and the install is successful!

Use only Swedish servers in tor browser

If you want to use only Swedish servers in Tor browser (or any other country) to connect on you can do it like this:
1. Open the file “torrc” at “Tor Browser\Browser\TorBrowser\Data\Tor\”.

2. Add line “ExitNodes {countryCode}”.
You can use country code se for swedish, gb or us for english and so on) at end of the file.
3. Save the file and restart the browser.


Unable to launch the IIS Express Web server

Unable to launch the IIS Express Web server.
Output from IIS Express. Failed to register URL for site. The format of the specified network name is invalid 0x800704BE.

The error occured beacause I had a IP binding to added with: “netsh http add iplisten”

To remove IP-binding you can use the following command (requires admin permission)

1. Remove current ip listening: netsh http delete iplisten {ip-address}
2. Listen to all ip addresses: netsh http add iplisten

Export PFX file from CRT/CER/P7B

Certificate handling. If you want to export a PFX file from a .CRT, .CER or .P7B file, follow these steps:

1. Install Windows 10 SDK (

2. Navigate to folder: C:\Program Files (x86)\Windows Kits\10\bin\10.0.16299.0\x64.

3. Start “certmgr.exe”.

4. In the window that opens you will se a list of all the certificates that are installed. Select the certificate you want export. The click on the button “Export”.

5. Follow the Export Wizard. You will now be able to select export as a PFX file.