调试在IIS中运行的ASP.NET Core应用程序 [英] Debugging ASP.NET Core applications running in IIS

查看:594
本文介绍了调试在IIS中运行的ASP.NET Core应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在IIS下运行时,有没有办法调试ASP.NET Core Web应用程序?

Is there any way to debug an ASP.NET Core web application while running under IIS?

我在IIS下运行,因为我需要在端口443上通过SSL使用它。

I'm running under IIS because I need it to be available over SSL on port 443.

推荐答案


  1. 使用调试配置发布Web应用程序

  2. 按照描述>

  3. 在浏览器中打开网站以启动dotnet流程

  4. 在Visual Studio中打开调试 - >附加到进程或按Ctrl + Alt + P

  5. 确保在附加到行中有自动或管理(v4 .6,v4.5,v4.0)。如果没有,请按选择并选择自动确定要调试的代码类型

  6. 选中显示所有用户的流程

  7. 选择 dotnet.exe 并按附件

  1. Publish web application with Debug configuration
  2. Set up web site on IIS as described here
  3. Open web site in browser to have dotnet process started
  4. In Visual Studio open Debug -> Attach to Process or press Ctrl+Alt+P
  5. Make sure in "Attach to" line you have "Automatic" or "Managed (v4.6, v4.5, v4.0)". If not, press select and choose "Automatically determine the type of code to debug"
  6. Check "Show processes from all users"
  7. Select dotnet.exe and press Attach

注意:如果你看到几个dnx.exe进程,在列用户名中选择一个IIS用户。默认情况下,它是IIS APPPOOL {您的应用程序池名称}

Note: If you see several dnx.exe processes, choose the one with IIS user in column username. By default it is "IIS APPPOOL{your app pool name}"

P.S。如果您看到带有空用户名的dotnet进程,请以管理员身份运行Visual Studio

P.S. If you see dotnet process with empty username, run Visual studio as Administrator

使用ASP.Net Core 1.0.0您必须附加到{youprojectnamet.exe}。例如。如果您的项目名称为Web,则必须附加到Web.exe
此外,您还可以在web.config的以下部分中找到执行程序的名称

With ASP.Net Core 1.0.0 you must attach to "{youprojectnamet.exe}". E.g. if you project has name "Web", you must attach to "Web.exe" Also you can find name of the executive in the following section of web.config

<system.webServer>
   <aspNetCore processPath=".\Web.exe" />
</system.webServer>

这篇关于调试在IIS中运行的ASP.NET Core应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆