martes, 28 de noviembre de 2017

Quickstart for .NET in the App Engine Flexible Environment

  1. Use the GCP Console to create a new GCP project, create an App Engine application, and enable billing: 
    GO TO APP ENGINE
    When prompted, select the region where you want your App Engine application located and then enable billing.
  2. Install the following prerequisites locally:
    1. Download and install the Google Cloud SDK and then initialize the gcloud tool: 
      DOWNLOAD THE SDK
    2. Install the .NET Core SDK, LTS version.
    3. If you are using Visual Studio, to build and run .NET core applications you must install .NET Core tools.
      • Images are available for ASP.NET Core apps written for .NET Core 1.0, 1.1, and 2.0.
    4. To deploy to App Engine directly from Visual Studio, install Google Cloud Tools for Visual Studio.
This quickstart assumes that you are familiar with building web applications with C#.

Download the Hello World app

We've created a simple Hello World app for .NET so you can quickly get a feel for deploying an app to the App Engine flexible environment. It's basically the same application you get when you use Visual Studio to create an empty ASP.NET core application, with an added app.yaml file. The app.yaml file is a App Engine configuration file that specifies your runtime and other App Engine specific settings.
  1. Download the sample app and extract it.
  2. If you're using the command line, navigate into the app directory, dotnet-docs-samples\appengine\flexible\HelloWorld.

Run Hello World on your local machine

VISUAL STUDIO

COMMAND LINE

To run the Hello World app on your local computer:
  1. Run the following commands from the dotnet-docs-samples\appengine\flexible\HelloWorld directory:
    dotnet restore dotnet run
  2. In your web browser, navigate to http://localhost:5000/
    You can see the "Hello World" message from the sample app displayed in the page.
  3. In your terminal window, press Ctrl+C to exit the web server.

Deploy and run Hello World on App Engine

VISUAL STUDIO

COMMAND LINE

  1. Run the following commands from the dotnet-docs-samples\appengine\flexible\HelloWorld directory:
    dotnet restore dotnet publish -c Release gcloud app deploy .\bin\Release\netcoreapp1.0\publish\app.yaml
  2. Launch your browser and view the app at http://YOUR_PROJECT_ID.appspot.com, by running the following command:
    gcloud app browse
This time, the page that displays the Hello World message is delivered by a web server running on an App Engine instance.
Congratulations! You've deployed your first .NET app to App Engine flexible environment!
See the following sections for information about cleaning up as well as links to the possible next steps that you can take.

No hay comentarios:

Publicar un comentario