You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/debugger/remote-debugging-aspnet-on-a-remote-iis-7-5-computer.md
+56-25Lines changed: 56 additions & 25 deletions
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
---
2
2
title: "Remote debug ASP.NET on an IIS computer"
3
3
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
5
5
ms.topic: "conceptual"
6
6
author: "mikejo5000"
7
7
ms.author: "mikejo"
@@ -117,7 +117,7 @@ You can use this option to create a publish settings file and import it into Vis
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.
121
121
122
122
When you're ready, switch to a debug configuration.
123
123
@@ -199,57 +199,86 @@ For information on running the remote debugger as a service, see [Run the remote
199
199
200
200
## <aname="BKMK_attach"></a> Attach to the ASP.NET application from the Visual Studio computer
201
201
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
+
203
208
2. In Visual Studio, select **Debug > Attach to Process** (Ctrl + Alt + P).
204
209
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).
207
212
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.
209
216
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**.
211
218
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**
218
220
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**
220
222
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
221
242
4. Select **Refresh**.
222
-
You should see some processes appear in the **Available Processes** window.
223
243
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.
225
249
226
250
5. Check **Show processes from all users**.
227
251
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.
229
253
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.

258
+
::: moniker-end
259
+
::: moniker range="vs-2019"
260
+

261
+
::: moniker-end
233
262
234
-
7. Select **Attach**
263
+
7. Select **Attach**.
235
264
236
265
8. Open the remote computer's website. In a browser, go to **http://\<remote computer name>**.
237
266
238
-
You should see the ASP.NET web page.
267
+
You should see the ASP.NET web page.
239
268
240
269
9. In the running ASP.NET application, select the link to the **Privacy** page.
241
270
242
-
The breakpoint should be hit in Visual Studio.
271
+
The breakpoint should be hit in Visual Studio.
243
272
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).
245
274
246
275
## Troubleshooting IIS deployment
247
276
248
277
- If you can't connect to the host using the host name, try the IP address instead.
249
278
- Make sure the required ports are open on the remote server.
250
279
- 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.
251
280
- 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.
253
282
- Check the Output window in Visual Studio for status information, and check your error messages.
254
283
255
284
## <aname="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:
277
306
278
307
### Open a port
279
308
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**.
281
312
282
313
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.
Copy file name to clipboardExpand all lines: docs/debugger/remote-debugging-aspnet-on-a-remote-iis-computer.md
+50-21Lines changed: 50 additions & 21 deletions
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
---
2
2
title: Remote debug ASP.NET Core on a remote IIS computer
3
3
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
5
5
ms.topic: "conceptual"
6
6
author: "mikejo5000"
7
7
ms.author: "mikejo"
@@ -44,7 +44,7 @@ This article includes steps on setting up a basic configuration of IIS on Window
44
44
45
45
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**.
46
46
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.
48
48
49
49
1. Open the *HomeController.cs* file in the Controllers folder and set a breakpoint in the `return View;` statement in the `Privacy` method.
50
50
@@ -71,6 +71,9 @@ When you download the software, you might get requests to grant permission to lo
71
71
72
72
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).
73
73
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
+
74
77
For .NET Core 2, install the [.NET Core Windows Server Hosting](https://aka.ms/dotnetcore-2-windowshosting).
75
78
76
79
> [!NOTE]
@@ -113,7 +116,7 @@ You can use this option create a publish settings file and import it into Visual
113
116
114
117
After the app deploys successfully, it should start automatically.
115
118
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.
117
120
- For ASP.NET Core, make sure the Application pool field for the **DefaultAppPool** is set to **No Managed Code**.
118
121
119
122
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
178
181
179
182
For information on running the remote debugger as a service, see [Run the remote debugger as a service](../debugger/remote-debugging.md#bkmk_configureService).
180
183
181
-
## <aname="BKMK_attach"></a> Attach to the ASP.NET application from the Visual Studio computer
184
+
## <aname="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).
182
189
183
190
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).
184
191
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).
186
193
187
194
> [!TIP]
188
195
> 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).
189
196
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**.
191
202
192
203
Verify that Visual Studio adds the required port to the computer name, which appears in the format: **\<remote computer name>:port**
193
204
194
-
::: moniker range=">=vs-2022"
195
205
On Visual Studio 2022, you should see **\<remote computer name>:4026**
196
-
::: moniker-end
197
206
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
+
199
222
On Visual Studio 2019, you should see **\<remote computer name>:4024**
200
-
::: moniker-end
201
223
202
224
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**.
205
227
206
228
You should see some processes appear in the **Available Processes** window.
207
229
208
230
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.
209
231
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.
211
233
212
-
1. Check **Show processes from all users**.
234
+
5. Check **Show processes from all users**.
213
235
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.
215
237
216
238
* 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.
217
239
218
240
* Otherwise, select the **dotnet.exe** process. (This is the out-of-process hosting model.)
219
241
220
242
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.

246
+
::: moniker-end
247
+
::: moniker range="vs-2019"
248
+

249
+
::: moniker-end
223
250
224
-
1. Select **Attach**.
251
+
7. Select **Attach**.
225
252
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>**.
227
254
228
255
You should see the ASP.NET web page.
229
256
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.
231
258
232
259
The breakpoint should be hit in Visual Studio.
233
260
@@ -240,7 +267,7 @@ For information on running the remote debugger as a service, see [Run the remote
240
267
- For ASP.NET Core, you need to make sure that the Application pool field for the **DefaultAppPool** is set to **No Managed Code**.
241
268
- 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.
242
269
- 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.
244
271
- Check the Output window in Visual Studio for status information, and check your error messages.
245
272
246
273
## <aname="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:
270
297
271
298
### Open a port
272
299
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**.
274
303
275
304
1. Then choose **Inbound Rules > New Rule > Port**, and then select **Next**. (For UDP 3702, choose **Outbound Rules** instead.)
0 commit comments