Skip to content

Instantly share code, notes, and snippets.

@laurentkempe
Last active June 4, 2017 20:39
Show Gist options
  • Save laurentkempe/38e29bb3942d167a252d13e56d8a45a9 to your computer and use it in GitHub Desktop.
Save laurentkempe/38e29bb3942d167a252d13e56d8a45a9 to your computer and use it in GitHub Desktop.
ASPNET-Core-MVC-app-running-on-raspberry-pi
> mkdir mvc
> cd mvc
> dotnet new mvc
The template "ASP.NET Core Web App" was created successfully.
This template contains technologies from parties other than Microsoft, see https://github.com/dotnet/templating/blob/rel/vs2017/post-rtw/template_feed/THIRD-PARTY-NOTICES for details.
Processing post-creation actions...
Running 'dotnet restore' on C:\@Projects\pi\mvc\mvc.csproj...
Restore succeeded.
C:\@Projects\pi
> dotnet -h
.NET Command Line Tools (2.0.0-preview1-005791)
Usage: dotnet [host-options] [command] [arguments] [common-options]
laurent@laurent-desktop:~/core/mvc$ dotnet mvc.dll
Hosting environment: Production
Content root path: /home/laurent/core/mvc
Now listening on: http://[::]:8000
Application started. Press Ctrl+C to shut down.
> dotnet publish -r ubuntu.16.04-arm
Microsoft (R) Build Engine version 15.2.93.5465
Copyright (C) Microsoft Corporation. All rights reserved.
mvc -> C:\@Projects\pi\mvc\bin\Debug\netcoreapp2.0\ubuntu.16.04-arm\mvc.dll
mvc -> C:\@Projects\pi\mvc\bin\Debug\netcoreapp2.0\ubuntu.16.04-arm\publish\
> dotnet restore
Restoring packages for C:\@Projects\pi\mvc\mvc.csproj...
Restoring packages for C:\@Projects\pi\mvc\mvc.csproj...
Restore completed in 2.01 sec for C:\@Projects\pi\mvc\mvc.csproj.
Lock file has not changed. Skipping lock file write. Path: C:\@Projects\pi\mvc\obj\project.assets.json
Restore completed in 2.82 sec for C:\@Projects\pi\mvc\mvc.csproj.
NuGet Config files used:
C:\@Projects\pi\mvc\NuGet.Config
C:\Users\laure\AppData\Roaming\NuGet\NuGet.Config
C:\Program Files (x86)\NuGet\Config\Microsoft.VisualStudio.Offline.config
Feeds used:
https://dotnet.myget.org/F/dotnet-core/api/v3/index.json
https://dotnet.myget.org/F/aspnetcore-ci-dev/api/v3/index.json
https://dotnet.myget.org/F/msbuild/api/v3/index.json
https://api.nuget.org/v3/index.json
C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<RuntimeFrameworkVersion>2.0.0-preview1-001978-00</RuntimeFrameworkVersion>
<RuntimeIdentifiers>ubuntu.16.04-arm</RuntimeIdentifiers>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore" Version="2.0.0-preview1-*" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.0.0-preview1-*" />
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="2.0.0-preview1-*" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="2.0.0-preview1-*" />
<PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink" Version="2.0.0-preview1-*" />
</ItemGroup>
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.0-preview1-*" />
</ItemGroup>
</Project>
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
namespace mvc
{
public class Program
{
public static void Main(string[] args)
{
var host = new WebHostBuilder()
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseUrls("http://*:8000")
.UseIISIntegration()
.ConfigureConfiguration((context, configBuilder) => {
configBuilder
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
.AddJsonFile($"appsettings.{context.HostingEnvironment.EnvironmentName}.json", optional: true)
.AddEnvironmentVariables();
})
.ConfigureLogging(loggerFactory => loggerFactory
.AddConsole()
.AddDebug())
.UseStartup<Startup>()
.Build();
host.Run();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment