How to get metadata using Svcutil.exe with an endpoint that has Tls 1.2

I tried to use the recommended way from the documentation as well but I could not get it to work. So I assumed that it uses some custom configuration sections. Instead I am currently using the following console application to load svcutil.exe and set the required property manually:

using System.Net;
using System.Reflection;

namespace SvcUtil2
    class Program
        static void Main(string[] args)
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
            // Your SvcUtil path here
            var svcUtilPath = @"C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.7.1 Tools\SvcUtil.exe";
            var svcUtilAssembly = Assembly.LoadFile(svcUtilPath);
            svcUtilAssembly.EntryPoint.Invoke(null, new object[] { args });

I know that it might not answer your actual question but I hope it is still useful.

The solution is to follow and add the HKEY provided in the following link to allow TLS 1.2 only services via svcutil:

In short, the solution is as follows:

  • Add the following registry setting DWORD value as 1 and restart the box: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v4.0.30319\SchUseStrongCrypto

  • If the application is 32bit running on x64 windows, we need to modify the same key under the:
    HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v4.0.30319\ SchUseStrongCrypto

I've tried after adding the same and restarting the machine and it works.