You've already forked linux-packaging-mono
Imported Upstream version 5.20.0.180
Former-commit-id: ff953ca879339fe1e1211f7220f563e1342e66cb
This commit is contained in:
parent
0e2d47d1c8
commit
0510252385
21
external/corert/samples/WebApi/README.md
vendored
21
external/corert/samples/WebApi/README.md
vendored
@@ -1,13 +1,10 @@
|
||||
# Building a WebAPI app with CoreRT
|
||||
|
||||
This document will guide you through compiling a .NET Core Web API application with CoreRT.
|
||||
CoreRT is an AOT-optimized .NET Core runtime. This document will guide you through compiling a .NET Core Web API application with CoreRT.
|
||||
|
||||
## Install the .NET Core SDK
|
||||
CoreRT is an AOT-optimized .NET Core runtime. If you're new to .NET Core make sure to visit the [official starting page](http://dotnet.github.io). It will guide you through installing pre-requisites and building your first app.
|
||||
If you're already familiar with .NET Core make sure you've [downloaded and installed the .NET Core 2 SDK](https://www.microsoft.com/net/download/core).
|
||||
_Please ensure that [pre-requisites](../prerequisites.md) are installed._
|
||||
|
||||
## Create your app
|
||||
|
||||
Open a new shell/command prompt window and run the following commands.
|
||||
```bash
|
||||
> dotnet new webapi -o myApp
|
||||
@@ -51,6 +48,10 @@ services.AddMvc();
|
||||
to
|
||||
|
||||
```csharp
|
||||
var applicationPartManager = new ApplicationPartManager();
|
||||
applicationPartManager.ApplicationParts.Add(new AssemblyPart(typeof(Startup).Assembly));
|
||||
services.Add(new ServiceDescriptor(typeof(ApplicationPartManager), applicationPartManager));
|
||||
|
||||
services.AddMvcCore().AddJsonFormatters();
|
||||
```
|
||||
|
||||
@@ -86,9 +87,9 @@ where path_to_rdxml_file is the location of the file on your disk.
|
||||
Under the second `<ItemGroup>` remove the line containing a reference to `Microsoft.AspNetCore.All` and substitute it with:
|
||||
|
||||
```xml
|
||||
<PackageReference Include="Microsoft.AspNetCore" Version="2.0.1" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.0.1" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Formatters.Json" Version="2.0.1" />
|
||||
<PackageReference Include="Microsoft.AspNetCore" Version="2.1.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.1.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Formatters.Json" Version="2.1.0" />
|
||||
```
|
||||
|
||||
This substitution removes unnecessary package references added by AspNetCore.All, which will remove them from your application's published files and avoid encountering unsupported features, as described in [the section above](#add-core-mvc-services)
|
||||
@@ -132,12 +133,12 @@ where `<Configuration>` is your project configuration (such as Debug or Release)
|
||||
> dotnet publish -r win-x64 -c release
|
||||
```
|
||||
|
||||
Once completed, you can find the native executable in the root folder of your project under `/bin/x64/<Configuration>/netcoreapp2.0/publish/`
|
||||
Once completed, you can find the native executable in the root folder of your project under `/bin/x64/<Configuration>/netcoreapp2.1/publish/`
|
||||
|
||||
## Try it out!
|
||||
|
||||
If you are running macOS, make sure you have [libuv](https://github.com/libuv/libuv) installed, as ASP.NET is built on top of libuv. You can use [homebrew](https://brew.sh/) to get it (`brew install libuv`).
|
||||
|
||||
Navigate to `/bin/x64/<Configuration>/netcoreapp2.0/publish/` in your project folder and run the produced executable. It should display "Now listening on: http://localhost:XXXX" with XXXX being a port on your machine. Open your browser and navigate to that URL. You should see "Hello World!" displayed in your browser.
|
||||
Navigate to `/bin/x64/<Configuration>/netcoreapp2.1/publish/` in your project folder and run the produced executable. It should display "Now listening on: http://localhost:XXXX" with XXXX being a port on your machine. Open your browser and navigate to that URL. You should see "Hello World!" displayed in your browser.
|
||||
|
||||
Feel free to modify the sample application and experiment. However, keep in mind some functionality might not yet be supported in CoreRT. Let us know on the [Issues page](https://github.com/dotnet/corert/issues/).
|
||||
|
||||
Reference in New Issue
Block a user