Skip to content

Commit c9884a7

Browse files
Merge pull request #10214 from MicrosoftDocs/main638495105574686332sync_temp
For protected branch, push strategy should use PR and merge to target branch method to work around git push error
2 parents fc9824b + 8e29a1f commit c9884a7

10 files changed

+188
-92
lines changed
Loading
Loading
Loading
Loading
Loading

docs/debugger/remote-debugging-aspnet-on-a-remote-iis-7-5-computer.md

Lines changed: 56 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "Remote debug ASP.NET on an IIS computer"
33
description: Learn how to set up and configure a Visual Studio ASP.NET MVC 4.8 application, deploy it to IIS, and attach the remote debugger from Visual Studio.
4-
ms.date: 11/21/2023
4+
ms.date: 04/23/2024
55
ms.topic: "conceptual"
66
author: "mikejo5000"
77
ms.author: "mikejo"
@@ -117,7 +117,7 @@ You can use this option to create a publish settings file and import it into Vis
117117

118118
[!INCLUDE [install-web-deploy-with-hosting-server](../deployment/includes/import-publish-settings-vs.md)]
119119

120-
After the app deploys successfully, it should start automatically. If the app doesn't start from Visual Studio, start the app in IIS to verify that it runs correctly.
120+
After the app deploys successfully, it should start automatically. If the app doesn't start after deployment, start the app in IIS to verify that it runs correctly.
121121

122122
When you're ready, switch to a debug configuration.
123123

@@ -199,57 +199,86 @@ For information on running the remote debugger as a service, see [Run the remote
199199

200200
## <a name="BKMK_attach"></a> Attach to the ASP.NET application from the Visual Studio computer
201201

202-
1. On the Visual Studio computer, open the solution that you're trying to debug (**MyASPApp** if you're following the steps in this article).
202+
::: moniker range=">=vs-2022"
203+
204+
Starting in Visual Studio 2022 version 17.10 Preview 2, the Attach to Process dialog box has changed. If you need instructions that match the older dialog box, switch to the Visual Studio 2019 view (upper left version selector in the article).
205+
206+
1. On the Visual Studio computer, open the solution that you're trying to debug (**MyASPApp** if you're following all the steps in this article).
207+
203208
2. In Visual Studio, select **Debug > Attach to Process** (Ctrl + Alt + P).
204209

205-
> [!TIP]
206-
> In Visual Studio 2017 and later versions, you can reattach to the same process you previously attached to by using **Debug > Reattach to Process...** (Shift+Alt+P).
210+
> [!TIP]
211+
> In Visual Studio 2017 and later versions, you can reattach to the same process you previously attached to by using **Debug > Reattach to Process...** (Shift + Alt + P).
207212

208-
3. Set the Qualifier field to **\<remote computer name>** and press **Enter**.
213+
3. Set the **Connection Type** to **Remote (Windows)**.
214+
215+
The **Connection Target** option appears.
209216

210-
Verify that Visual Studio adds the required port to the computer name, which appears in the format: **\<remote computer name>:port**
217+
Set the **Connection Target** to **\<remote computer name>** and press **Enter**.
211218

212-
::: moniker range=">=vs-2022"
213-
On Visual Studio 2022, you should see **\<remote computer name>:4026**
214-
::: moniker-end
215-
::: moniker range="vs-2019"
216-
On Visual Studio 2019, you should see **\<remote computer name>:4024**
217-
::: moniker-end
219+
Verify that Visual Studio adds the required port to the computer name, which appears in the format: **\<remote computer name>:port**
218220

219-
The port is required. If you don't see the port number, add it manually.
221+
On Visual Studio 2022, you should see **\<remote computer name>:4026**
220222

223+
The port is required. If you don't see the port number, add it manually.
224+
::: moniker-end
225+
226+
::: moniker range="vs-2019"
227+
1. On the Visual Studio computer, open the solution that you're trying to debug (**MyASPApp** if you're following all the steps in this article).
228+
229+
2. In Visual Studio, select **Debug > Attach to Process** (Ctrl + Alt + P).
230+
231+
> [!TIP]
232+
> In Visual Studio 2017 and later versions, you can reattach to the same process you previously attached to by using **Debug > Reattach to Process...** (Shift + Alt + P).
233+
234+
3. Set the Qualifier field to **\<remote computer name>** and press **Enter**.
235+
236+
Verify that Visual Studio adds the required port to the computer name, which appears in the format: **\<remote computer name>:port**
237+
238+
On Visual Studio 2019, you should see **\<remote computer name>:4024**
239+
240+
The port is required. If you don't see the port number, add it manually.
241+
::: moniker-end
221242
4. Select **Refresh**.
222-
You should see some processes appear in the **Available Processes** window.
223243

224-
If you don't see any processes, try using the IP address instead of the remote computer name (the port is required). You can use `ipconfig` in a command line to get the IPv4 address.
244+
You should see some processes appear in the **Available Processes** window.
245+
246+
If you don't see any processes, try using the IP address instead of the remote computer name (the port is required). You can use `ipconfig` in a command line to get the IPv4 address.
247+
248+
If you want to use the **Find** button, you might need to [open outbound UDP port 3702](#bkmk_openports) on the server.
225249

226250
5. Check **Show processes from all users**.
227251

228-
6. Type the first letter of a process name to quickly find **w3wp.exe** for ASP.NET 4.5.
252+
6. Type the first letter of a process name to quickly find *w3wp.exe* for ASP.NET 4.5.
229253

230-
If you have multiple processes showing **w3wp.exe**, check the **User Name** column. In some scenarios, the **User Name** column shows your app pool name, such as **IIS APPPOOL\DefaultAppPool**. If you see the App Pool, an easy way to identify the correct process is to create a new named App Pool for the app instance you want to debug, and then you can find it easily in the **User Name** column.
254+
If you have multiple processes showing w3wp.exe, check the User Name column. In some scenarios, the User Name column shows your app pool name, such as IIS APPPOOL\DefaultAppPool. If you see the App Pool, an easy way to identify the correct process is to create a new named App Pool for the app instance you want to debug, and then you can find it easily in the User Name column.
231255

232-
![RemoteDBG_AttachToProcess](../debugger/media/vs-2019/remotedbg-attachtoprocess.png "RemoteDBG_AttachToProcess")
256+
::: moniker range=">=vs-2022"
257+
![Screenshot of Attach to Process dialog.](../debugger/media/vs-2022/remote-debug-attach-to-process-aspnet-core.png "RemoteDBG_AttachToProcess")
258+
::: moniker-end
259+
::: moniker range="vs-2019"
260+
![Screenshot of Attach to Process dialog.](../debugger/media/vs-2019/remotedbg-attachtoprocess-aspnetcore.png "RemoteDBG_AttachToProcess")
261+
::: moniker-end
233262

234-
7. Select **Attach**
263+
7. Select **Attach**.
235264

236265
8. Open the remote computer's website. In a browser, go to **http://\<remote computer name>**.
237266

238-
You should see the ASP.NET web page.
267+
You should see the ASP.NET web page.
239268

240269
9. In the running ASP.NET application, select the link to the **Privacy** page.
241270

242-
The breakpoint should be hit in Visual Studio.
271+
The breakpoint should be hit in Visual Studio.
243272

244-
If you're unable to attach or hit the breakpoint, see [Troubleshoot remote debugging](../debugger/troubleshooting-remote-debugging.md).
273+
If you're unable to attach or hit the breakpoint, see [Troubleshoot remote debugging](../debugger/troubleshooting-remote-debugging.md).
245274

246275
## Troubleshooting IIS deployment
247276

248277
- If you can't connect to the host using the host name, try the IP address instead.
249278
- Make sure the required ports are open on the remote server.
250279
- Verify that the version of ASP.NET used in your app is the same as the version you installed on the server. For your app, you can view and set the version in the **Properties** page. To set the app to a different version, that version must be installed.
251280
- If the app tried to open, but you see a certificate warning, choose to trust the site. If you already closed the warning, you can edit the publishing profile, a *.pubxml file, in your project and add the following element (for test only): `<AllowUntrustedCertificate>true</AllowUntrustedCertificate>`
252-
- If the app doesn't start from Visual Studio, start the app in IIS to test that it deployed correctly.
281+
- After it's deployed, start the app in IIS to test that it deployed correctly.
253282
- Check the Output window in Visual Studio for status information, and check your error messages.
254283

255284
## <a name="bkmk_openports"></a> Open required ports on Windows Server
@@ -277,7 +306,9 @@ In addition, these ports should already be opened by the ASP.NET installation:
277306

278307
### Open a port
279308

280-
1. To open a port on Windows Server, open the **Start** menu, search for **Windows Firewall with Advanced Security**.
309+
1. To open a port on Windows Server, open the **Start** menu, search for **Windows Defender Firewall** or **Windows Firewall with Advanced Security**.
310+
311+
For **Windows Defender Firewall**, choose **Advanced settings**.
281312

282313
1. Then choose **Inbound Rules > New Rule > Port**. Choose **Next** and under **Specific local ports**, enter the port number, select **Next**, then **Allow the Connection**, select Next, and add the name (**IIS**, **Web Deploy**, or **msvsmon**) for the Inbound Rule.
283314

docs/debugger/remote-debugging-aspnet-on-a-remote-iis-computer.md

Lines changed: 50 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Remote debug ASP.NET Core on a remote IIS computer
33
description: Debug an ASP.NET Core application that has been deployed to a remote Internet Information Services (IIS) computer using the Visual Studio remote debugger.
4-
ms.date: 11/21/2023
4+
ms.date: 04/23/2024
55
ms.topic: "conceptual"
66
author: "mikejo5000"
77
ms.author: "mikejo"
@@ -44,7 +44,7 @@ This article includes steps on setting up a basic configuration of IIS on Window
4444

4545
In Visual Studio, choose **File** > **Start window** to open the Start window, and then choose **Create a new project**. In the search box, type **web app**, then choose **C#** as the language, then choose **ASP.NET Core Web Application (Model-View-Controller)**, and then choose **Next**. On the next screen, name the project **MyASPApp**, and then choose **Next**.
4646

47-
Choose either the recommended target framework or .NET 8, and then choose **Create**.
47+
Choose either the recommended target framework or .NET 8, and then choose **Create**. The version must match the version installed on the server.
4848

4949
1. Open the *HomeController.cs* file in the Controllers folder and set a breakpoint in the `return View;` statement in the `Privacy` method.
5050

@@ -71,6 +71,9 @@ When you download the software, you might get requests to grant permission to lo
7171

7272
For the current .NET Core hosting bundle, install the [ASP.NET Core Hosting Bundle](https://dotnet.microsoft.com/permalink/dotnetcore-current-windows-runtime-bundle-installer).
7373

74+
> [!NOTE]
75+
> If you previously installed IIS, the ASP.NET Core IIS Module gets installed with ASP.NET Core. Otherwise, install the ASP.NET Core IIS Module manually.
76+
7477
For .NET Core 2, install the [.NET Core Windows Server Hosting](https://aka.ms/dotnetcore-2-windowshosting).
7578

7679
> [!NOTE]
@@ -113,7 +116,7 @@ You can use this option create a publish settings file and import it into Visual
113116

114117
After the app deploys successfully, it should start automatically.
115118

116-
- If the app doesn't start from Visual Studio, start the app in IIS to verify that it runs correctly.
119+
- If the app doesn't start after deployment, start the app in IIS to verify that it runs correctly.
117120
- For ASP.NET Core, make sure the Application pool field for the **DefaultAppPool** is set to **No Managed Code**.
118121

119122
When you're ready, switch to a debug configuration.
@@ -178,56 +181,80 @@ Download the version of the remote tools that matches your version of Visual Stu
178181
179182
For information on running the remote debugger as a service, see [Run the remote debugger as a service](../debugger/remote-debugging.md#bkmk_configureService).
180183

181-
## <a name="BKMK_attach"></a> Attach to the ASP.NET application from the Visual Studio computer
184+
## <a name="BKMK_attach"></a> Attach to the ASP.NET Core application from the Visual Studio computer
185+
186+
::: moniker range=">=vs-2022"
187+
188+
Starting in Visual Studio 2022 version 17.10 Preview 2, the Attach to Process dialog box has changed. If you need instructions that match the older dialog box, switch to the Visual Studio 2019 view (upper left version selector in the article).
182189

183190
1. On the Visual Studio computer, open the solution that you're trying to debug (**MyASPApp** if you're following all the steps in this article).
184191

185-
1. In Visual Studio, select **Debug > Attach to Process** (Ctrl + Alt + P).
192+
2. In Visual Studio, select **Debug > Attach to Process** (Ctrl + Alt + P).
186193

187194
> [!TIP]
188195
> In Visual Studio 2017 and later versions, you can reattach to the same process you previously attached to by using **Debug > Reattach to Process...** (Shift + Alt + P).
189196
190-
1. Set the Qualifier field to **\<remote computer name>** and press **Enter**.
197+
3. Set the **Connection Type** to **Remote (Windows)**.
198+
199+
The **Connection Target** option appears.
200+
201+
Set the **Connection Target** to **\<remote computer name>** and press **Enter**.
191202

192203
Verify that Visual Studio adds the required port to the computer name, which appears in the format: **\<remote computer name>:port**
193204

194-
::: moniker range=">=vs-2022"
195205
On Visual Studio 2022, you should see **\<remote computer name>:4026**
196-
::: moniker-end
197206

198-
::: moniker range="vs-2019"
207+
The port is required. If you don't see the port number, add it manually.
208+
::: moniker-end
209+
210+
::: moniker range="vs-2019"
211+
1. On the Visual Studio computer, open the solution that you're trying to debug (**MyASPApp** if you're following all the steps in this article).
212+
213+
2. In Visual Studio, select **Debug > Attach to Process** (Ctrl + Alt + P).
214+
215+
> [!TIP]
216+
> In Visual Studio 2017 and later versions, you can reattach to the same process you previously attached to by using **Debug > Reattach to Process...** (Shift + Alt + P).
217+
218+
3. Set the Qualifier field to **\<remote computer name>** and press **Enter**.
219+
220+
Verify that Visual Studio adds the required port to the computer name, which appears in the format: **\<remote computer name>:port**
221+
199222
On Visual Studio 2019, you should see **\<remote computer name>:4024**
200-
::: moniker-end
201223

202224
The port is required. If you don't see the port number, add it manually.
203-
204-
1. Select **Refresh**.
225+
::: moniker-end
226+
4. Select **Refresh**.
205227

206228
You should see some processes appear in the **Available Processes** window.
207229

208230
If you don't see any processes, try using the IP address instead of the remote computer name (the port is required). You can use `ipconfig` in a command line to get the IPv4 address.
209231

210-
If you want to use the **Find** button, you might need to [open UDP port 3702](#bkmk_openports) on the server.
232+
If you want to use the **Find** button, you might need to [open outbound UDP port 3702](#bkmk_openports) on the server.
211233

212-
1. Check **Show processes from all users**.
234+
5. Check **Show processes from all users**.
213235

214-
1. Type the first letter of your process name to quickly find your app.
236+
6. Type the first letter of your process name to quickly find your app.
215237

216238
* If you're using the [in-process hosting model](/aspnet/core/host-and-deploy/aspnet-core-module?view=aspnetcore-3.1&preserve-view=true#hosting-models) on IIS, select the correct **w3wp.exe** process. Starting in .NET Core 3, this process is the default.
217239

218240
* Otherwise, select the **dotnet.exe** process. (This is the out-of-process hosting model.)
219241

220242
If you have multiple processes showing *w3wp.exe* or *dotnet.exe*, check the **User Name** column. In some scenarios, the **User Name** column shows your app pool name, such as **IIS APPPOOL\DefaultAppPool**. If you see the App Pool, but it's not unique, create a new named App Pool for the app instance you want to debug, and then you can find it easily in the **User Name** column.
221243

222-
![RemoteDBG_AttachToProcess](../debugger/media/vs-2019/remotedbg-attachtoprocess-aspnetcore.png "RemoteDBG_AttachToProcess")
244+
::: moniker range=">=vs-2022"
245+
![Screenshot of Attach to Process dialog.](../debugger/media/vs-2022/remote-debug-attach-to-process-aspnet-core.png "RemoteDBG_AttachToProcess")
246+
::: moniker-end
247+
::: moniker range="vs-2019"
248+
![Screenshot of Attach to Process dialog.](../debugger/media/vs-2019/remotedbg-attachtoprocess-aspnetcore.png "RemoteDBG_AttachToProcess")
249+
::: moniker-end
223250

224-
1. Select **Attach**.
251+
7. Select **Attach**.
225252

226-
1. Open the remote computer's website. In a browser, go to **http://\<remote computer name>**.
253+
8. Open the remote computer's website. In a browser, go to **http://\<remote computer name>**.
227254

228255
You should see the ASP.NET web page.
229256

230-
1. In the running ASP.NET application, select the link to the **Privacy** page.
257+
9. In the running ASP.NET application, select the link to the **Privacy** page.
231258

232259
The breakpoint should be hit in Visual Studio.
233260

@@ -240,7 +267,7 @@ For information on running the remote debugger as a service, see [Run the remote
240267
- For ASP.NET Core, you need to make sure that the Application pool field for the **DefaultAppPool** is set to **No Managed Code**.
241268
- Verify that the version of ASP.NET used in your app is the same as the version you installed on the server. For your app, you can view and set the version in the **Properties** page. To set the app to a different version, that version must be installed.
242269
- If the app tried to open, but you see a certificate warning, choose to trust the site. If you already closed the warning, you can edit the publishing profile, a *.pubxml file, in your project and add the following element (for test only): `<AllowUntrustedCertificate>true</AllowUntrustedCertificate>`
243-
- If the app doesn't start from Visual Studio, start the app in IIS to test that it deployed correctly.
270+
- After it's deployed, start the app in IIS to test that it deployed correctly.
244271
- Check the Output window in Visual Studio for status information, and check your error messages.
245272

246273
## <a name="bkmk_openports"></a> Open required ports on Windows Server
@@ -270,7 +297,9 @@ In addition, these ports should already be opened by the ASP.NET installation:
270297

271298
### Open a port
272299

273-
1. To open a port on Windows Server, open the **Start** menu, search for **Windows Firewall with Advanced Security**.
300+
1. To open a port on Windows Server, open the **Start** menu, search for **Windows Defender Firewall** or **Windows Firewall with Advanced Security**.
301+
302+
For **Windows Defender Firewall**, choose **Advanced settings**.
274303

275304
1. Then choose **Inbound Rules > New Rule > Port**, and then select **Next**. (For UDP 3702, choose **Outbound Rules** instead.)
276305

0 commit comments

Comments
 (0)