선택사항으로 app.yaml 파일에 runtime_version 설정을 포함하여 런타임 버전을 지정할 수 있습니다. runtime_version 설정을 지정하지 않으면 App Engine에서 기본적으로 사용 가능한 최신 LTS .NET 버전을 사용합니다.
예를 들어 Ubuntu 22에서 .NET 8을 지정하면 app.yaml 파일은 다음과 같이 보입니다.
App Engine은 부하 분산기에서 HTTPS 연결을 종료하고 요청을 애플리케이션에 전달합니다. 애플리케이션은 X-Forwarded-Proto를 검사하여 원래 프로토콜이 HTTP였는지 HTTPS였는지 확인합니다.
일부 애플리케이션은 사용자 IP 주소도 확인해야 합니다. 사용자 IP 주소는 표준 X-Forwarded-For 헤더에서 제공됩니다.
런타임 확장
가변형 환경의 .NET 런타임을 사용하여 커스텀 런타임을 만들 수 있습니다.
커스텀 런타임은 Dockerfile을 통해 구성됩니다.
원하는 대로 Dockerfile 및 .dockerignore를 맞춤설정할 수 있습니다. 마지막으로 app.yaml에서 runtime: aspnetcore 대신 runtime: custom을 지정해야 합니다. 자세한 내용은 .NET 런타임 맞춤설정을 참조하세요.
환경 변수
런타임 환경에서 설정되는 환경 변수는 다음과 같습니다.
환경 변수
설명
GAE_INSTANCE
현재 인스턴스의 이름입니다.
GAE_MEMORY_MB
애플리케이션 프로세스에서 사용할 수 있는 메모리 양입니다.
GAE_SERVICE
애플리케이션의 app.yaml 파일에 지정된 서비스 이름이거나 서비스 이름이 지정되지 않은 경우 default로 설정됩니다.
GAE_VERSION
현재 애플리케이션의 버전 라벨입니다.
GOOGLE_CLOUD_PROJECT
애플리케이션과 연결된 프로젝트 ID로, Google Cloud 콘솔에 표시됩니다.
PORT
HTTP 요청을 수신할 포트입니다.
appsettings.json을 사용하여 추가 구성 변수를 설정할 수 있습니다.
메타데이터 서버
애플리케이션의 각 인스턴스는 Compute Engine 메타데이터 서버를 사용해 호스트 이름, 외부 IP 주소, 인스턴스 ID, 커스텀 메타데이터, 서비스 계정 정보 등의 인스턴스 관련 정보를 쿼리할 수 있습니다. App Engine에서는 인스턴스별로 커스텀 메타데이터를 설정할 수 없습니다. 하지만 개발자는 프로젝트 전체의 커스텀 메타데이터를 설정한 후 App Engine 및 Compute Engine 인스턴스에서 읽을 수 있습니다.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-09-04(UTC)"],[[["\u003cp\u003eThe .NET runtime in the flexible environment manages the installation and execution of your application's code and dependencies, with .NET 8 utilizing buildpacks.\u003c/p\u003e\n"],["\u003cp\u003eTo use a specific supported .NET version, update your project file with the desired version, ensure you have gcloud CLI version 420.0.0 or later, and define the \u003ccode\u003eoperating_system\u003c/code\u003e and optionally \u003ccode\u003eruntime_version\u003c/code\u003e in your \u003ccode\u003eapp.yaml\u003c/code\u003e file.\u003c/p\u003e\n"],["\u003cp\u003eOlder .NET versions, specifically 3 and earlier, have reached their end of support, and deploying applications with these runtimes is blocked; upgrading to a supported version is recommended.\u003c/p\u003e\n"],["\u003cp\u003eFor .NET versions not directly supported, custom runtimes can be created by selecting a valid base image with the required .NET version, or by using Docker to deploy your application.\u003c/p\u003e\n"],["\u003cp\u003eApp Engine uses environment variables like \u003ccode\u003eGAE_INSTANCE\u003c/code\u003e, \u003ccode\u003eGAE_SERVICE\u003c/code\u003e, and \u003ccode\u003ePORT\u003c/code\u003e to provide information about your application instance, and applications can query the Compute Engine metadata server for more details.\u003c/p\u003e\n"]]],[],null,["# The .NET runtime\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\n| **Note:** Some [.NET runtimes](/appengine/docs/flexible/lifecycle/support-schedule#net) have reached [end of support](/appengine/docs/flexible/lifecycle/runtime-lifecycle#end_of_support). You cannot re-deploy versions that use runtimes after their end of support date. We recommend that you [upgrade your app](/appengine/docs/flexible/dotnet/runtime#newversions) to use the latest version of .NET.\n\n\u003cbr /\u003e\n\nThe .NET runtime is the software stack responsible for\ninstalling your application code and dependencies, and then running that\napplication in the flexible environment.\n\n.NET versions\n-------------\n\n.NET 8 is built using\n[buildpacks](/docs/buildpacks/overview). For the full list of supported\n.NET versions, and their corresponding Ubuntu\nversion, see the [Runtime support schedule](/appengine/docs/flexible/lifecycle/support-schedule#net).\n\nTo use a [supported](/appengine/docs/flexible/lifecycle/support-schedule#net)\n.NET version, you must:\n\n- Update your project file with the .NET version you want to use.\n\n \u003cProject Sdk=\"Microsoft.NET.Sdk.Web\"\u003e\n\n \u003cPropertyGroup\u003e\n \u003cTargetFramework\u003enet8.0\u003c/TargetFramework\u003e\n \u003cNullable\u003eenable\u003c/Nullable\u003e\n \u003cImplicitUsings\u003eenable\u003c/ImplicitUsings\u003e\n \u003c/PropertyGroup\u003e\n\n \u003cItemGroup\u003e\n \u003cNone Update=\"app.yaml\"\u003e\n \u003cCopyToPublishDirectory\u003ePreserveNewest\u003c/CopyToPublishDirectory\u003e\n \u003c/None\u003e\n \u003c/ItemGroup\u003e\n\n \u003c/Project\u003e\n\n For more information see [Migrate from ASP.NET Core 3.1 to 6.0](https://learn.microsoft.com/en-us/aspnet/core/migration/31-to-60?view=aspnetcore-6.0&tabs=visual-studio.).\n- Install gcloud CLI version **420.0.0 or later** . You can update your\n CLI tooling by running the [gcloud components update](/sdk/gcloud/reference/components/update)\n command. To view your installed version, you can run the\n [gcloud version](/sdk/gcloud/reference/version) command.\n\n- Specify the `operating_system` setting in your [`app.yaml`](/appengine/docs/flexible/reference/app-yaml) file:\n\n runtime: aspnetcore\n env: flex\n\n runtime_config:\n operating_system: \"ubuntu22\"\n\n- Optionally, you can specify a runtime version by including the `runtime_version`\n setting in your `app.yaml` file. By default, App Engine uses the latest\n available LTS .NET version if the `runtime_version` setting is not specified.\n For example, the `app.yaml` file looks as follows when specifying\n .NET 8 on Ubuntu 22:\n\n runtime: aspnetcore\n env: flex\n\n runtime_config:\n runtime_version: \"8\"\n operating_system: \"ubuntu22\"\n\nPrevious runtime versions\n-------------------------\n\n| **Warning:** .NET **version 3 and earlier** have reached end of support. App Engine blocks you from deploying your applications using runtimes that have reached end of support. We recommend that you migrate your app to use a [supported version](/appengine/docs/flexible/lifecycle/support-schedule#net) of .NET or use a [custom runtime](/appengine/docs/flexible/custom-runtimes/about-custom-runtimes).\n\nTo target a specific .NET SDK version, update your project file. For more\ninformation, see [Migrate from ASP.NET Core 3.1 to 6.0](https://learn.microsoft.com/en-us/aspnet/core/migration/31-to-60?view=aspnetcore-6.0&tabs=visual-studio.).\n\nIf you want to use GKE or other Docker hosts, you need to create a\nDockerfile that copies your application code and installs\ndependencies. For more information, see\n[Custom Runtimes](/appengine/docs/flexible/custom-runtimes).\n\nTo deploy your .NET app, run the following commands from the\nroot directory where your app resides: \n\n dotnet restore\n dotnet publish -c Release\n gcloud app deploy\n\nSupport for other .NET runtimes\n-------------------------------\n\nIf you need to use a .NET version that isn't [supported](/appengine/docs/flexible/lifecycle/support-schedule#net), you can create a\n[custom runtime](/appengine/docs/flexible/custom-runtimes/build) and select a\nvalid base image with the .NET version you need.\n\nFor Google-supplied base images or\n[Docker .NET base images](https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/docker/building-net-docker-images?view=aspnetcore-8.0),\nsee [Building custom runtimes](/appengine/docs/flexible/custom-runtimes/build#base).\n\nHTTPS and forwarding proxies\n----------------------------\n\nApp Engine terminates the HTTPS connection at the load balancer and forwards the\nrequest to your application. Applications can examine the `X-Forwarded-Proto` to\nobserve whether the original protocol was HTTP or HTTPS.\n\nSome applications also need to ascertain the user's IP address. This is\navailable in the standard `X-Forwarded-For` header.\n\nExtending the runtime\n---------------------\n\nThe flexible environment .NET runtime can be used to create a custom runtime.\nCustom runtimes are configured via a `Dockerfile`.\n\nYou can customize the `Dockerfile` and `.dockerignore` as desired. Finally,\nyou will need to specify `runtime: custom` instead of `runtime: aspnetcore` in\n`app.yaml`. See\n[Customizing the .NET Runtime](/appengine/docs/flexible/dotnet/customizing-the-dotnet-runtime)\nfor more information.\n\nEnvironment variables\n---------------------\n\nThe following environment variables are set by the runtime environment:\n\nYou can set additional configuration variables with `appsettings.json`.\n\nMetadata server\n---------------\n\nEach instance of your application can use the\n[Compute Engine metadata server](/compute/docs/storing-retrieving-metadata) to\nquery information about the instance, including its host name, external IP\naddress, instance ID, custom metadata, and service account information. App\nEngine does not allow you to set custom metadata for each instance, but you can\nset [project-wide custom metadata](/compute/docs/storing-retrieving-metadata#projectwide)\nand read it from your App Engine and Compute Engine instances.\n\nThis example function uses the metadata server to get the external IP address of\nthe instance: \n\n var client = new HttpClient();\n client.DefaultRequestHeaders.Add(\"Metadata-Flavor\", new[] { \"Google\" });\n response = await client.GetStringAsync(\n \"http://metadata.google.internal/computeMetadata/v1/instance/network-interfaces/0/access-configs/0/external-ip\");"]]