asp.net - 如何确定生产 ASP.NET 站点是否正在以调试版本运行?

标签 asp.net powershell debug-mode

我知道代码在 Release模式下构建时会进行优化,并且应该始终部署到生产环境中,但我想知道是否有办法查明您的代码是否已使用调试版本部署与使用调试版本部署。发布版本。

PowerShell cmdlet 是否是此类查询的潜在途径?

最佳答案

尝试这样的函数:

function Test-DebugAssembly($path) {
     $assembly = [Reflection.Assembly]::LoadFile("$path")
     $attr = $assembly.GetCustomAttributes([Diagnostics.DebuggableAttribute], $false)
     if (!$attr) { 
         $false 
     }
     else {
         $attr.IsJITTrackingEnabled
     }
 }

关于asp.net - 如何确定生产 ASP.NET 站点是否正在以调试版本运行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18157830/

相关文章:

c# - 在 asp.net 应用程序中编辑/删除导航栏

powershell - 如何在 Powershell 中将元素添加到数组前面?

java - Eclipse Kepler x64 Debug模式 tomcat 未启动

c++编译错误在调试但不是在发布

Odoo 10 开发者模式和带 Assets 的开发者模式

C# httpClient 不返回内容

c# - 创建的动态按钮单击事件 OnPreRender 不会触发

c# - 如何从代码隐藏中调用按钮单击事件处理程序

java - 在 Java 程序中执行 PowerShell 命令

powershell - 需要 PowerShell 2.0 替换 string.replace 方法