1

I want to build a self Host of a Web Api 2 Webservice. I am using the .Net Core 1.0 Framework for my Console App and also for the Web Api 2 Project.

Since there was a name change for the packages and Owin is deprecated, I am not able to rebuild the given samples in the official GitHub repository of ASPnet:

https://github.com/aspnet/Hosting/blob/dev/samples/SampleStartups/StartupHelloWorld.cs (I tried with this one)

I looked in the project.json file which packages they are using but since I can´t find the AspNetCore.Hosting package only a package named AspNet.Hosting but i isn´t working with both packages.

{
  "version": "1.0.0-*",
  "dependencies": {
    "Microsoft.AspNetCore.Hosting": "1.0.0-*",
    "Microsoft.NETCore.Platforms": "1.0.1-*"
},

Resharper says something like :

Severity Code Description Project File Line Suppression State Error CS0246 The type or namespace name 'WebHostBuilder' could not be found (are you missing a using directive or an assembly reference?) WebApiConsoleHost.DNX 4.5.1, WebApiConsoleHost.DNX Core 5.0

Just to be complete, I used the whole Main Function Body of the given sample in the Link:

public static void Main(string[] args)
{
    var host = new WebHostBuilder()
        .UseDefaultConfiguration(args)
        .UseStartup<StartupHelloWorld>()
        .Build();

    host.Run();
}

Do someone know where the WebHostBuilder class is defined ? Resharper suggests that it is in AspNet.Hosting, but after adding the using it is still not found!

1 Answer 1

2

Try to read the latest docs. It is working for me.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.