.Net Webapi – Unable to start Kestrel

While taking some Azure certifications, I have several times experienced this error during some Labs.

After creating a new webapi with

dotnet new webapi --output . --name SimpleApi

the ensuing

dotnet run

always fails with this error on my Windows 10 development pc.

info: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[0]
User profile is available. Using ‘C:\Users\XXXX\AppData\Local\ASP.NET\DataProtection-Keys’ as key repository and Windows DPAPI to encrypt keys at rest.
crit: Microsoft.AspNetCore.Server.Kestrel[0]
Unable to start Kestrel.
System.InvalidOperationException: Unable to configure HTTPS endpoint. No server certificate was specified, and the default developer certificate could not be found or is out of date.
To generate a developer certificate run ‘dotnet dev-certs https’. To trust the certificate (Windows and macOS only) run ‘dotnet dev-certs https –trust’.
For more information on configuring HTTPS see https://go.microsoft.com/fwlink/?linkid=848054.

The instructions on this page does not initially help much. As other people also experience, one dotnet dev-certs command says no valid certificates exist while another says that one already exists.
What have worked for me until now, is to first clear my pc of all existing dev certificates and then generate a new one. I seem to have to do this everytime i create a new project…

dotnet dev-certs https –clean
dotnet dev-certs https –trust

I always comment out the app.UseHttpsRedirection(); in the autogenerated Startup.cs class, but it does not make any difference.

Why does SQLPlus not execute my command-file

Oracle SQLPlus is an effective tool, but sometimes it has some hard-to-explain behavior.

Like when you try to get it to replace an existing view, and all that happens, is that it very patiently does – nothing at all.

There are several possible reasons – where SQLPlus has requirements that other SQL tools (like Toad) does not have.

http://www.vertabelo.com/blog/notes-from-the-lab/blank-lines-in-sql-plus

  1. Blank lines prevent the execution of a command in SQL*PlusA blank line in a SQL statement or script tells SQL*Plus that you have finished entering the command, but do not want to run it yet.If you’re writing or generating SQL scripts for SQL*Plus, make sure there are no blank lines in your SQL commands or the statements will not be executed.

    This only seems to be required for views. Packages are executed even if they contain some blank lines

  2. Package replace script must end with a “/”

[srs_total_visitors]

Windows (many versions) caches old AD-account information

Windows – both client and server, in many versions – caches old AD-account information.

Most often, this gives problems, when a user changes their username in AD, but on another server, the old username is cached and associated with the users SID. So when a username for a given SID is requested on the other server, the old username is returned.

The reasoning behind the functionality can be found here:

The LsaLookupSids function may return the old user name instead of the new user name if the user name has changed

The cache can be disabled by inserting DWORD 0 in registry-key HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\LsaLookupCacheMaxSize

This article gives no other method to reset the cache – apart from restarting the server.

Other users have found better solutions – such as running the short 2-line PowerShell given below, which updates the cached AD-information for the given user.

http://serverfault.com/questions/266180/purging-ad-principal-from-cache

$objuser = new-object system.security.principal.ntaccount “domain\<new account name>”
$objuser.translate([system.security.principal.securityidentifier])