Microsoft.Owin and related packages have no goals for .NET Core, no for .NET Standard. All they have is dlls aimed at full .NET. You can reference such libraries from your .NET Core project, but they are not guaranteed to work, as you can see, because the API (a set of classes \ methods \ signatures) is different for all .NET and .NET Core. Visual Studio will even show a warning when you do this, for example:
The package 'Microsoft.Owin 3.1.0' was restored using '.NETFramework, Version = v4.6.1' instead of the project target scheme '.NETCoreApp, Version = v2.0. This package may not be compatible with your project.
There is a Microsoft.AspNetCore.Owin package, and you can use the OWIN middleware in the .NET Core application, as described in the first link, but almost all that it provides is the UseOwin extension UseOwin . There is no type of AppBuilder , etc., and there are no Microsoft.AspNetCore.Owin.Cors packages or the like. Thus, you must either implement all this yourself (there is no reason, because you can use the same functions as in the framework of the main asp.net infrastructure), or wait for OWIN packages aimed at .NET Standard \ Core and do it (did not check, perhaps they already exist).
Thus, your code uses packages that are really not compatible with your target structure, as an exception that you show at runtime. So another answer (for some reason, top-down) is technically correct.
If you still want to use these packages reliably, you need to configure the full .NET Framework, not the .NET Core. To do this, open the .csproj file and change
<TargetFramework>netcoreapp2.0</TargetFramework>
For some versions of the .NET Framework that support the .NET Standard 2.0, for example:
<TargetFramework>net47</TargetFramework>
Then go to the nuget package manager, and if you have the microsoft.aspnetcore.all package (or other packages targeting .NET Core) - uninstall it, you wonβt need it anyway. Then install the Microsoft.AspNetCore package and all other asp.net core packages you need (if they are not already installed). Rebuild, run, and everything will be fine.
This works because all (most?) AspNetCore packages target the .NET Standard, not the .NET Core, and you can use them in projects that target the full .NET Framework.
Please note that in doing this, you have an asp.net Core project, but not on .NET Core, with all the consequences that follow from this (it cannot work with dotnet run , on linux you need to work with mono, etc.) ,.