C# 将调试器附加到 IIS 实例

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/848987/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-05 04:05:05  来源:igfitidea点击:

Attach Debugger to IIS instance

c#asp.netvisual-studio-2005debugging

提问by Mihai Lazar

I have IIS 5.1 on a XP machine, and visual studio 2005. How do I go about attaching my debugger to IIS instance.

我在 XP 机器上安装了 IIS 5.1,在 Visual Studio 2005 上安装了 IIS。如何将调试器附加到 IIS 实例。

BTW: I'm not seeing the IIS process within the running processes or probably I don't know what to look for .

顺便说一句:我没有在正在运行的进程中看到 IIS 进程,或者我可能不知道要查找什么。

采纳答案by Al W

In Visual Studio:

在 Visual Studio 中:

  1. Click "Debug" from the menu bar
  2. Click "Attach to Process"
  3. Check the "Show processes from all users" checkbox in the bottom left corner
  4. Select aspnet_wp.exe, w3p.exe, or w3wp.exefrom the process list
  5. Click "Attach"
  1. 单击菜单栏中的“调试”
  2. 单击“附加到进程”
  3. 选中左下角的“显示所有用户的进程”复选框
  4. 从进程列表中选择aspnet_wp.exew3p.exew3wp.exe
  5. 点击“附加”

回答by Jimmie R. Houts

The IIS process is aspnet_wp.exe.

IIS 进程是aspnet_wp.exe。

In fact, attaching to the aspnet_wp.exe process is what VS does when you have your project set to use IIS for debugging.

事实上,当您将项目设置为使用 IIS 进行调试时,VS 所做的就是附加到 aspnet_wp.exe 进程。

回答by Mike

You'll also need to open Internet Information Service From Control Panel > Administrative Tools. Right click the web site in question, click the home directory tab, and select the configuration button. This will open a new form with three tabs - click the debugging one and select the two options in the debugging flag section. This is also necessary to debug.

您还需要从控制面板 > 管理工具打开 Internet 信息服务。右键单击相关网站,单击主目录选项卡,然后选择配置按钮。这将打开一个包含三个选项卡的新表单 - 单击调试一个并在调试标志部分选择两个选项。这也是调试所必需的。

回答by Amitd

Just to clarify Jimmie R. Houts answer…

只是为了澄清 Jimmie R. Houts 的回答……

If you want to debug the web application VS and IIS you can do the following:

如果要调试 Web 应用程序 VS 和 IIS,可以执行以下操作:

  1. Host the site inside IIS (virtual directory etc).
  2. Then in VS2005 do this:

    • Right Click on Web Project → Properties → Start options → Use Custom Server → Base URL → Enter Site Address as Hosted in IIS.
    • Hit F5and you will be able to Debug your code
  1. 在 IIS 内托管站点(虚拟目录等)。
  2. 然后在 VS2005 中这样做:

    • 右键单击 Web 项目 → 属性 → 开始选项 → 使用自定义服务器 → 基本 URL → 输入站点地址作为托管在 IIS 中。
    • 点击F5,您将能够调试您的代码

Same works for VS 2008 also.

同样适用于 VS 2008。

回答by The Coder

I'm running Windows 7 with IIS Version 7.5 and I also needed to tick the "Show processes from all users" and "Show processes in all sessions" boxes - at the bottom of the "Attach to Process" dialog.

我正在使用 IIS 7.5 版运行 Windows 7,我还需要勾选“显示所有用户的进程”和“显示所有会话中的进程”框 - 在“附加到进程”对话框的底部。

Also I had put my app in a specific App Pool which means you can then see it labeled against the w3wp.exe.

此外,我已将我的应用程序放在特定的应用程序池中,这意味着您可以看到它标记为 w3wp.exe。

回答by fiat

Using an Attach to IIS plugin (VS2015, VS2017) plugin saves a few clicks - especially when dealing with an ecosystem of IIS hosted sites (one frontend with multiple backend services say)

使用附加到 IIS 插件(VS2015VS2017)插件可以节省几次点击 - 特别是在处理 IIS 托管站点的生态系统时(一个前端具有多个后端服务说)

回答by Michael Freidgeim

The possible names of the ASP.NET process:

ASP.NET 进程的可能名称:

  • w3wp.exe is IIS 6.0 and later.
  • aspnet_wp.exe is earlier versions of IIS.
  • iisexpress.exe is IISExpress.
  • dotnet.exe is ASP.NET Core.
  • inetinfo.exe is older ASP applications running in-process.
  • w3wp.exe 是 IIS 6.0 及更高版本。
  • aspnet_wp.exe 是 IIS 的早期版本。
  • iisexpress.exe 是 IISExpress。
  • dotnet.exe 是 ASP.NET Core。
  • inetinfo.exe 是在进程中运行的较旧的 ASP 应用程序。

From Find the name of the ASP.NET process

查找 ASP.NET 进程的名称