Skip to content

Repo sync for protected branch #10429

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 16 commits into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified docs/deployment/media/publish-iis-web-deploy-latest.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 25 additions & 5 deletions docs/deployment/quickstart-deploy-aspnet-web-app.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,6 @@ Next, you see the summary page for the new [publish profile](./publish-overview.

You can come back to this summary page after you close it. Next time you right-click and choose **Publish**, Visual Studio opens this summary page. (To get back to the Publish wizard just click **New** in the summary page.)

To view or change the settings, select the **Show all settings** link, or click on any of the pencil icons. The **Settings** page appears. Here, you can change the configuration to publish, the target framework, the [deployment mode](/dotnet/core/deploying/), or the target Runtime ID (RID) (see [.NET RID catalog](/dotnet/core/rid-catalog)). You can choose to delete all the existing files in the target folder every time you publish, or not. If you expect to add files that aren't part of what Visual Studio deploys, clear the checkbox.

## [FTP/FTPS](#tab/ftp-ftps)
## Publish your web app to an FTP/FTPS server

Expand All @@ -124,7 +122,20 @@ You can come back to this summary page after you close it. The next time you rig
## [Web Server](#tab/web-server)
## Publish your web app to Web Server (IIS)

You can publish your web app to IIS.
You can publish your web app to IIS if IIS is configured. By default, IIS Express is installed, but you should install the IIS Management tools if you're deploying to IIS from Visual Studio. Note that you don't need to run Visual Studio as Administrator to deploy to IIS Express, only to full IIS.

### Configure the web server

On the remote web server, install the [Web Management Service](/iis/manage/remote-administration/remote-administration-for-iis-manager). Be sure to follow the instructions there to enable remote connections, and make sure the service is started, set up your credentials to remotely administer the web server, and verify them before attempting to deploy. Web Management Service is not required for a local IIS deployment.

On the web server, install **IIS 6 Metabase Compatibility**. In Windows Settings, under **Programs and Features**, choose **Turn Windows features on or off**. Then under **Internet Information Services** > **Web Management Tools**, install **IIS 6 Management Compatibility**. Make sure that **IIS Metabase** and **IIS 6 configuration compatibility** are selected.

To configure IIS for ASP.NET Core applications, install the [.NET Core Hosting Bundle installer (direct download)](https://dotnet.microsoft.com/permalink/dotnetcore-current-windows-runtime-bundle-installer). For more information, see [.NET Core hosting bundle](/aspnet/core/host-and-deploy/iis/hosting-bundle).

If you're working with ASP.NET 4.8 or earlier, or if you need to configure IIS on Windows Server for publishing, you can find detailed steps in [Remote debugging ASP.NET on an IIS computer](../debugger/remote-debugging-aspnet-on-a-remote-iis-7-5-computer.md) and for ASP.NET Core, [Remote debugging ASP.NET Core on an IIS computer](../debugger/remote-debugging-aspnet-on-a-remote-iis-7-5-computer.md).
### Publish to IIS web server

Choose **Publish**, and then **Web Server (IIS)**.

![Screenshot showing the option to publish to IIS.](./media/publish-iis.png)

Expand All @@ -134,11 +145,16 @@ Pick the desired deployment mode. Choose Web Deploy to immediately deploy the ap

### Web Deploy

Provide the necessary connection details and choose **Finish**.
Provide the necessary connection details and choose **Finish**. The following screenshot shows a web application published to the default IIS web site (Default Web Site) installed on the local development machine, with a port binding on port 5187. The Destination URL is optional. If not provided, the web site is not automatically launched on publish, and there won't be a link on the **Publish** screen to access the published site.

![Screenshot showing the Publish wizard screen to publish to IIS with the Web Deploy option.](./media/publish-iis-web-deploy-latest.png)

On the remote computer, make sure that Web Deploy is installed and that the Web Management Service is started. See [Web Deploy error codes](/troubleshoot/developer/webapps/iis/deployment-migration/web-deploy-error-codes#ERROR_DESTINATION_NOT_REACHABLE).
The first time you publish, create a username and password. These credentials are specific to WebDeploy deployment. Once they're created, you can't change them in Visual Studio, but you can reset them in IIS. See [Sites - Set Credentials dialog box](/previous-versions/windows/it-pro/windows-server-2012-R2-and-2012/hh831681(v=ws.11)?redirectedfrom=MSDN#set-credentials-dialog-box). If you don't have the password, you can download a `.publishsettings` file, and read it from there. See [Import publish settings from IIS](./tutorial-import-publish-settings-iis.md).

> [!WARNING]
> Using username and password credentials is not the most secure method of authentication. Whenever possible, use alternative methods. For example, when hosting a web site in Azure App Service, you can use authentication tokens for improved security.

For troubleshooting, see [Web Deploy error codes](/troubleshoot/developer/webapps/iis/deployment-migration/web-deploy-error-codes#ERROR_DESTINATION_NOT_REACHABLE).

### Web Deploy Package

Expand All @@ -159,6 +175,10 @@ You can import publish settings [from IIS](./tutorial-import-publish-settings-ii

---

## Next steps

Manage settings for your web application deployment. By managing settings, you can control the .NET deployment options, as well as behaviors such as how to handle existing files that are not part of the deployment process at the deployment destination. See [Manage web deployment settings](web-deployment-settings.md).

## Related Content

- [.NET application deployment](/dotnet/core/deploying/)
2 changes: 2 additions & 0 deletions docs/deployment/toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
href: /azure/app-service/quickstart-dotnetcore?tabs=net60&pivots=development-environment-vs#publish-your-web-app
- name: Deploy an ASP.NET Core app with Entity Framework to Azure using GitHub Actions
href: ../azure/end-to-end-deployment-entity-framework-core-github-actions.md
- name: Manage settings
href: web-deployment-settings.md
- name: Get publish settings from IIS
href: tutorial-import-publish-settings-iis.md
- name: Get publish settings from Azure
Expand Down
61 changes: 61 additions & 0 deletions docs/deployment/web-deployment-settings.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
---
title: Manage web deployment settings
description: Learn how to configure deployment settings for web applications in Visual Studio, when you publish a web application to Azure, IIS, or another target.
ms.date: 09/27/2024
ms.topic: how-to
helpviewer_keywords:
- "deployment settings, web app"
author: ghogen
ms.author: ghogen
manager: mijacobs
ms.subservice: deployment
monikerRange: '>= vs-2019'
#customer intent: As a web developer, I want to understand and control the deployment settings for my web app.
---
# Manage web deployment settings

You can control how your web application gets deployed using the settings.

## Prerequisite

Visual Studio with the Web Development workload installed.

## Manage settings

The **Show all settings** link appears after you run the **Publish** wizard to create a publish profile. The settings vary according to the type of deployment.

To view or change the settings, select the **Show all settings** link, or click on any of the pencil icons. The **Settings** page appears.

1. Click on the **Settings** link. The Settings screen opens.
1. The **Prev** button takes you to the previous screen with settings you can edit for some deployment types.
1. Expand the **File Publish Options** to view settings that relate to files that might already be on the site.
1. Expand the Database settings to view the database connection information, which can be different from what your app uses when running locally during development and testing.

The following table describes the settings. Click on the links for more information.

| Name | Profile types | Property | Description |
| - | - | - |
| Configuration | Folder, IIS | `LastUsedBuildConfiguration` | The project build configuration to deploy, for example, `Release`. |
| TargetFramework | Folder, IIS | `TargetFramework` | The version of .NET that the app is targeted to run on. This is already set by the project, but you can change it for deployment. |
| [Deployment mode](/dotnet/core/deploying/) | Folder, IIS | none or `SelfContained` | You can choose framework-dependent if you can depend on the runtime being available, or self-contained if you want to package the runtime with the application's publish artifacts. |
| [Target Runtime](/dotnet/core/rid-catalog) | Folder, IIS | | The .NET Runtime ID (RID) for this deployment. |
| Server | IIS | `MSDeployServiceURL` | The web server name, URI, or IP address. For example, `localhost`. |
| Site name | IIS | Site | The site name in IIS, for example, `Default Web Site`. |
| Username | IIS | `UserName` | The username you will use to access the site in IIS. |
| Password | IIS | `UserPWD` | The first time you publish, you create a password that you will use to publish the site. The password can't be changed in Visual Studio, but it can be changed in IIS or in Azure. If you don't know the password, you can get it by downloading the `.publishsettings` file. See [Import publish settings from IIS](tutorial-import-publish-settings-iis.md) and [Import publish settings from Azure](tutorial-import-publish-settings-azure.md). |
| Save password checkbox | IIS | `_SavePWD` | If checked, saves the password as plain text in the `.pubxml` file. |
| Destination URL | IIS | `SiteURLToLaunchAfterPublish` | The URL that launches the app, for example, `http://localhost/projectname`. If the IIS configuration for the web site exposes the site on a specific port in its bindings settings, include that as in `http://localhost:nnnn/projectname`. This is optional and only provides a convenient link on the Publish page, and is used to launch the site after a successful publish. |
| [Enable ReadyToRun compilation](/dotnet/core/deploying/ready-to-run) | Folder | `PublishReadyToRun` | ReadyToRun is a form of Ahead-of-time (AOT) compilation. It can reduce latency by avoiding Just-in-time (JIT) compilation at runtime. |
| [Trim unused code](/dotnet/core/deploying/trimming/trim-self-contained) | Folder | `PublishTrimmed` | Minimizes the size of a self-contained deployment. |
| [Produce single file](/dotnet/core/deploying/single-file/overview) | Folder | `PublishSingleFile` | An option that allows the published application to be distributed in a single file. |
| Remove additional files at destination | IIS | `SkipExtraFilesOnServer` | To preserve added files, uncheck the box. |
| Delete all existing files prior to publish. | FTP | `DeleteExistingFiles` | Uncheck this to preserve unrelated files at the destination, or check this to start with a clean deployment to the folder. |
|Package location| IIS WebDeploy Package|`DesktopBuildPackageLocation` | A local filesystem path to place the output package. |

## Next steps

The settings are persisted in the `.pubxml` file. The `.pubxml` file is an MSBuild input file. You can edit the file to further customize the deployment. See [MSBuild](../msbuild/msbuild.md).

## Related content

[Visual Studio .pubxml files](/aspnet/core/host-and-deploy/visual-studio-publish-profiles)