简体   繁体   中英

How to enable remote debugging of an MVC application which was deployed in IIS in remote web server

I want to debug an deployed MVC application in Visual studio.

Web server is Windows Server 2019 and MVC application published in IIS web server in this machine.

We will access MVC application through custom domain url.

I want to debug deployed MVC application in another local development computer (Windows 10 OS) where visual studio 2019 installed.

I have followed the below articles for enabling remote debugging.

https://docs.microsoft.com/en-us/visualstudio/debugger/remote-debugger-port-assignments?view=vs-2019

Enabled the Discovery Port UDP 3702 in Windows server 2019 where the MVC app deployed in IIS.

Installed the remote debugging tools for VS 2017 in remote windows server 2019 following the below article.

https://docs.microsoft.com/en-us/visualstudio/debugger/remote-debugging?view=vs-2019

I tried to connect to remote computer from VS 2019 of local development computer following below article

https://docs.microsoft.com/en-us/visualstudio/debugger/attach-to-running-processes-with-the-visual-studio-debugger?view=vs-2019#BKMK_Attach_to_a_process_on_a_remote_computer

But I'm unable to find remote webserver (Where MVC app deployed) in Connection target of VS Attach Process

Requirement:

In different development machine where VS 2019 installed, I want to debug MVC application which is deployed through IIS in another windows server 2019.

Note: In remote windows server 2019, multiple MVC apps has been deployed to IIS. In development machine, I want to just browse MVC app through custom domain url and debugging should start in Visual studio 2019.

Even I'm not getting, how to connect to single deployed MVC app remotely and attach debugger to it from development VS 2019 from development machine, since multiple MVC apps deployed in remote web server and I want to remote debug only particular MVC application.

Kindly let me know, how can I acheive this.

If you want to know how to remote debug the MVC application in VS , you could refer to below steps:

1.Copy remote debug folder to remote server's path:

C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\Remote Debugger\x64

Notice: Please click configure remote debugging, if it show notice window

Msvsmon:

在此处输入图片说明

在此处输入图片说明

  1. Publish the project with the debug mode to remote server

在此处输入图片说明

3.Then you could open Visual studio's tool menu and click options.

在此处输入图片说明

4.Find debugging and select symbols. Then should find your local project's bin folder path and add it into the symbol file locations as below:

Example: C:\\Users\\xxxx\\source\\repos\\WebAPIRemoteDebugTest\\WebAPIRemoteDebugTest\\bin

在此处输入图片说明

5.On the remote server click the server default page and find the worker processes.

在此处输入图片说明

6.Browser the web application which you want to remote debug

在此处输入图片说明

7.Open the worker processes it will show the process ID. You should remember it.

在此处输入图片说明

8.Open the visual studio's debug view and click attach to process.

在此处输入图片说明

9.Type in the server IP address or server name when you run the msvsmon and click find, it will show all the process which run on the server. You could search the processed which show in the worker process we have found in IIS.

在此处输入图片说明

If connect successfully, the msvsmon will show connected log.

在此处输入图片说明

10.Then you could debug your codes as local VS application . Add breakpoint at the codes which throw the error and use postman reproduce this issue.

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM