- Use the GCP Console to create a new GCP project, create an App Engine application, and enable billing: When prompted, select the region where you want your App Engine application located and then enable billing.
- Install the following prerequisites locally:
- Download and install the Google Cloud SDK and then initialize the
gcloud
tool: - Install the .NET Core SDK, LTS version.
- 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.
- To deploy to App Engine directly from Visual Studio, install Google Cloud Tools for Visual Studio.
- Download and install the Google Cloud SDK and then initialize the
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.- Download the sample app and extract it.
- 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
To run the Hello World app on your local computer:
- Run the following commands from the
dotnet-docs-samples\appengine\flexible\HelloWorld
directory:dotnet restore dotnet run
- In your web browser, navigate to http://localhost:5000/You can see the "Hello World" message from the sample app displayed in the page.
- In your terminal window, press Ctrl+C to exit the web server.
Deploy and run Hello World on App Engine
- 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
- Launch your browser and view the app at
http://YOUR_PROJECT_ID.appspot.com
, by running the following command:gcloud app browse
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