ASP.NET Core op Cloud9
Home

ASP.NET Core op Cloud9

ASP.NET Core op Cloud9

Chapeau

Installeren

Bron: Install for Ubuntu 14.04, 16.04, 16.10 & Linux Mint 17

  1. Maak een nieuwe workspace op Cloud9 en kies als type Empty
  2. check de geïnstalleerde versie van Ubuntu met:
    lsb_release -a
  3. Volg de instructies van de Microsoft website. Je moet alleen vooraleer je de .NET Core pakketten download het volgende pakket toevoegen:
    sudo apt-get install apt-transport-https
  4. Filmpje: Douglas Starnes, ASP.NET Core 1.0 on Cloud 9, Jul 29, 2016
  5. Ik gebruik niet Yo om een template te genereren maar dotnet-new waarmee je een nieuw .NET Core project kan maken in de openstaande directory:
    1. Create a new .NET Core project:
      1. mkdir aspnetcoreapp
      2. cd aspnetcoreapp
      3. dotnet new -t web
    2. Restore the packages:
      1. dotnet restore
    3. Run the app (the dotnet run command will build the app when it's out of date):
      1. dotnet run
    4. Browse to http://localhost:5000; deze poort is op Cloud9 niet beschikbaar je moet de program.cs bestand wijzigen:
      using System;
      using System.Collections.Generic;
      using System.IO;
      using System.Linq;
      using System.Threading.Tasks;
      using Microsoft.AspNetCore.Hosting;
      
      namespace WebApplication
      {
          public class Program
          {
              public static void Main(string[] args)
              {
                  var host = new WebHostBuilder()
                      .UseKestrel()
                      .UseContentRoot(Directory.GetCurrentDirectory())
                      .UseIISIntegration()
                      .UseStartup<Startup>()
                      .UseUrls("http://0.0.0.0:8080")
                      .Build();
      
                  host.Run();
              }
          }
      }
      
      

ASPNETCORE_ENVIRONMENT is an environment variable (and AFAIK) not a switch to the dotnet cli.

So what you would do is set it prior to using the tool:

rem Windows

C:\> set ASPNETCORE_ENVIRONMENT=Development

C:\> dotnet ...

rem Unix

$ export ASPNETCORE_ENVIRONMENT=Development

$ dotnet ...

Paragraaf

JI
2017-03-08 14:05:51