Kasper Sommer
Kasper Sommer

Reputation: 453

UseKestrel with listen options

I have a problem adding the listen options for my ASP.NET Core solution. I have tried a brand new solution, appending the program.cs to:

      .UseKestrel(options =>
      {
          options.Listen(IPAddress.Any, 5000);
          options.Listen(IPAddress.Any, 5001, listenOptions =>
          {
              listenOptions.UseHttps("/HTTPS_cert/https.pfx", "****");
          });
      })

The error I get is: "The name 'IPAddress' does not exist in the current context.

If I e.g. try with:

options.Limits.MaxConcurrentConnections = 100;

The server starts just fine. What am I missing?

I am using VS for Mac.

Thanks a lot...

Upvotes: 5

Views: 4406

Answers (1)

DavidG
DavidG

Reputation: 119017

You are just missing an import for System.Net as that is where the IPAddress.Any static field is. Just add this to your file:

using System.Net;

Upvotes: 4

Related Questions