Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
ASP.NET-App mit Tools for Visual Studio bereitstellen
Auf dieser Seite erfahren Sie, wie Sie Microsoft Visual Studio konfigurieren und eine ASP.NET-Anwendung erstellen und dann auf Google Cloudbereitstellen.
Hinweise
In the Google Cloud console, on the project selector page,
click Create project to begin creating a new
Google Cloud project.
Wählen Sie einen Bereitstellungsnamen und Einstellungen, und achten Sie darauf, dass
HTTP Traffic zulassen und Allow WebDeploy Traffic (WebDeploy-Traffic zulassen) ausgewählt sind.
Wählen Sie Bereitstellen.
Cloud Tools for Visual Studio installieren
So installieren Sie Cloud Tools for Visual Studio in Visual Studio über das Dialogfeld Erweiterungen und Updates:
Wählen Sie Tools > Erweiterungen und Updates aus.
Wählen Sie im linken Bereich den Tab Online aus.
Suchen Sie Google Cloud Tools for Visual Studio.
Klicken Sie auf Herunterladen und folgen Sie den Eingabeaufforderungen.
Starten Sie Visual Studio neu, um die Erweiterung zu laden.
Bei Google anmelden
Melden Sie sich bei einem Google-Konto an, das Sie zum Bereitstellen Ihres Projekts in App Engine verwenden.
Öffnen Sie Visual Studio.
Starten Sie Cloud Explorer. Wählen Sie Tools > Google Cloud Tools > Show Google Cloud Explorer (Google Cloud Explorer anzeigen) aus.
Klicken Sie auf Select or Create Account (Konto auswählen oder erstellen).
Klicken Sie auf Konto hinzufügen.
In einem neuen Browserfenster werden Sie nach den Berechtigungen gefragt, die zum Verwalten Ihrer Google Cloud -Ressourcen erforderlich sind.
Wählen Sie das Konto aus, das für Ihre Anwendung verwendet werden soll.
Klicken Sie auf Allow (Zulassen) und schließen Sie das Browserfenster.
Projekt auswählen
So wählen Sie ein Google Cloud -Projekt für die Bereitstellung Ihrer Anwendung aus:
Klicken Sie in Cloud Explorer auf Select Project (Projekt auswählen).
Wählen Sie Ihr Projekt in der Liste aus.
Klicken Sie auf OK.
Cloud Explorer wird mit den Ressourcen für das ausgewählte Projekt aktualisiert.
ASP.NET-Anwendung erstellen
So erstellen Sie ein neues ASP.NET-Projekt und führen es lokal aus:
Wählen Sie File > New > Project (Datei > Neu > Projekt) aus, um das Dialogfeld "New Project" (Neues Projekt) zu öffnen.
Gehen Sie im linken Bereich zu Installed (Installiert) > Visual C# > Google Cloud Platform.
Wählen Sie ASP.NET on Google Cloud Platform (ASP.NET auf Google Cloud Platform) aus.
Wenn Sie die Anwendung in einer VM in Compute Engine bereitstellen möchten, verwenden Sie .NET Framework anstelle von .NET Core. Für GKE oder App Engine verwenden Sie die Vorlage ASP.NET Core on Google Cloud Platform.
Geben Sie den Namen Ihres Projekts ein.
Klicken Sie auf OK.
Wählen Sie den Template type (Vorlagentyp) aus.
Klicken Sie auf OK.
Erstellen Sie die Lösung und führen Sie diese lokal aus, um zu prüfen, dass sie funktioniert.
ASP.NET-Anwendung bereitstellen
So stellen Sie Ihre ASP.NET-App auf einer Windows-VM bereit, die in Compute Engine ausgeführt wird:
Wählen Sie in Cloud Explorer das neu erstellte Projekt aus und maximieren Sie GKE.
Klicken Sie mit der rechten Maustaste auf die VM-Instanz, die Sie zuvor mit Cloud Marketplace erstellt haben.
Wählen Sie Manage Windows credentials (Windows-Anmeldedaten verwalten) aus.
Klicken Sie auf Add Credentials (Anmeldedaten hinzufügen)
Geben Sie einen Benutzernamen ein.
Achten Sie darauf, dass Create a password for me (Eigenes Passwort erstellen) ausgewählt ist, und klicken Sie auf Save (Speichern).
Wenn folgende Bestätigungsfrage erscheint, klicken Sie auf Reset (Zurücksetzen): "Reset the password for [your username] on the instance [instance you created]? ("Passwort für [Ihr Nutzername] in der Instanz [erstellte Instanz] zurücksetzen?")
Klicken Sie dann auf die Schaltfläche Close (Schließen), um das Passwortfenster zu schließen.
Klicken Sie anschließend auf die Schaltfläche Close (Schließen), um das Fenster Windows Credentials (Windows-Anmeldedaten) zu schließen.
Klicken Sie in Visual Studio im Bereich Solution Explorer (Projektmappen-Explorer) mit der rechten Maustaste auf die Anwendung.
Klicken Sie im Kontextmenü auf Publish to Google Cloud.
Wählen Sie im Dialogfeld zum Veröffentlichen Compute Engine.
Klicken Sie auf Publish (Veröffentlichen), um die Beispielanwendung zu erstellen und bereitzustellen.
Nach Abschluss der Veröffentlichung öffnet Visual Studio die Anwendung in Ihrem Standardwebbrowser:
Das ist alles – Ihre Anwendung wird in Compute Engine gehostet.
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Schwer verständlich","hardToUnderstand","thumb-down"],["Informationen oder Beispielcode falsch","incorrectInformationOrSampleCode","thumb-down"],["Benötigte Informationen/Beispiele nicht gefunden","missingTheInformationSamplesINeed","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 2025-08-17 (UTC)."],[],[],null,["# Quickstart: Deploy an ASP.NET app by using Tools for Visual Studio\n\nDeploy an ASP.NET app by using Tools for Visual Studio\n======================================================\n\nThis page shows you how to configure Microsoft Visual Studio and create and\ndeploy an ASP.NET application on Google Cloud.\n\nBefore you begin\n----------------\n\n1. In the Google Cloud console, on the project selector page,\n click **Create project** to begin creating a new\n Google Cloud project.\n\n [Go to project selector](https://console.cloud.google.com/projectselector2/home/dashboard)\n2.\n [Verify that billing is enabled for your Google Cloud project](/billing/docs/how-to/verify-billing-enabled#confirm_billing_is_enabled_on_a_project).\n\n3. Make sure that you have the following software installed on your local system:\n - [Visual Studio 2022](https://www.visualstudio.com/vs/), [Visual Studio 2019, or Visual Studio 2017](https://www.visualstudio.com/vs/older-downloads/), any Windows edition. Cloud Tools for Visual Studio doesn't support Visual Studio 2017 for Mac.\n - [gcloud CLI](/sdk/docs/install)\n4. Create a new Windows VM to host your app:\n 1. Navigate to the ASP.NET Framework image on the Google Cloud Marketplace. \n [Go to the ASP.NET Framework image](https://console.cloud.google.com/marketplace/details/click-to-deploy-images/aspnet)\n 2. Select **Launch on Compute Engine**.\n 3. Choose your **Deployment name** and settings, ensuring that **Allow HTTP Traffic** and **Allow WebDeploy Traffic** are checked.\n 4. Select **Deploy**.\n\nInstalling Cloud Tools for Visual Studio\n----------------------------------------\n\nTo install Cloud Tools for Visual Studio from the **Extensions and Updates** dialog in\nVisual Studio:\n\n1. Select **Tools** \\\u003e **Extensions and Updates**.\n2. Select the **Online** facet from the left pane.\n3. Search for **Google Cloud Tools for Visual Studio**.\n4. Click **Download** and follow the prompts.\n5. Restart Visual Studio to load the extension.\n\nSigning in to Google\n--------------------\n\nSign in to a Google account that you use to deploy your project to\nApp Engine.\n\n1. Open Visual Studio.\n2. Launch **Cloud Explorer** by selecting **Tools** \\\u003e **Google Cloud Tools** \\\u003e **Show Google Cloud Explorer**.\n3. Click **Select or create account**.\n4. Click **Add account**.\n5. A new browser window opens and asks for the permissions it needs to manage your Google Cloud resources.\n6. Select the account to use for your application.\n7. Click **Allow** and close the browser window.\n\n\u003cbr /\u003e\n\nSelecting a project\n-------------------\n\nTo select a Google Cloud project to deploy your application to:\n\n1. In the **Cloud Explorer** , click **Select Project**.\n2. Select your project in the list.\n3. Click **OK**.\n\nThe Cloud Explorer refreshes and displays the resources for the selected\nproject.\n\nCreating an ASP.NET app\n-----------------------\n\nTo create a new ASP.NET project and run it locally:\n\n1. Choose **File** \\\u003e **New** \\\u003e **Project** to open the New Project dialog.\n2. Use the left panel to navigate to **Installed** \\\u003e **Visual C#** \\\u003e **Google Cloud Platform**.\n3. Select **ASP.NET on Google Cloud Platform**.\n4. To deploy your app to a VM on Compute Engine, target the .NET Framework, not .NET Core. Use the **ASP.NET Core on Google Cloud Platform** template for GKE or App Engine.\n5. Enter the **Name** of your project.\n6. Click **OK**.\n7. Select the **Template type**.\n8. Click **OK**.\n9. Build the solution and run it locally, verifying that it works.\n\nDeploying an ASP.NET app\n------------------------\n\nTo deploy your ASP.NET app to a Windows VM running on Compute Engine:\n\n1. In Cloud Explorer, select the newly created project and expand GKE.\n2. Right-click on the VM instance that you created above with Cloud Marketplace.\n3. Select **Manage Windows credentials**.\n4. Click **Add credentials**.\n5. Enter a username.\n6. Ensure that **Create a password for me** is selected and click **Save**.\n7. Click **Reset** when prompted with the confirmation question: \"Reset the password for \\[your username\\] on the instance \\[instance you created\\]?\"\n8. Then click the **Close** button to close the password window.\n9. Next click the **Close** button to close the **Windows\n Credentials** window.\n10. In the Visual Studio **Solution Explorer** pane, right click your application.\n11. In the context menu, click **Publish to Google Cloud**\n12. In the Publish dialog box, choose **Compute Engine**.\n13. Click **Publish** to build and deploy the sample application. After publishing completes, Visual Studio opens the application in your default web browser:\n\nThat's it --- your application is hosted on Compute Engine.\n\nWhat's next\n-----------\n\n- Learn more about [Browsing Compute Engine Resources](/tools/visual-studio/docs/browse-compute)."]]