.net5 Azure Web App 断开连接无法正常调试 [英] .net5 Azure Web App can not be debugged properly due to disconnects

查看:27
本文介绍了.net5 Azure Web App 断开连接无法正常调试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个在 azure 上运行的 .NET5 服务.现在我尝试调试,我可以在此之后成功连接 问题.一个问题解决了,下一个:

I have a .NET5 Service running at azure. Now I try to debug and i can connect successfully after this issue. So one Problem solved, next:

但现在似乎是随机发生的,连接后调试器与服务断开连接.

But for now it seems to happen randomly, that after connection the debugger disconnects from service.

所以我做以下:

  • 在 azure 重启服务,做了很多次.还测试了停止服务并再次手动启动.
  • 立即按快捷方式进行重新附加处理,因为我想观看 ConfigureServices 方法.
  • 连接成功
  • 什么都不显示,意味着不会在任何断点处结束
  • 我可以慢点吗?不要这么认为和"Thread.Sleep ||任务.延迟"没有帮助赶上任何断点..
  • 连接后几乎不需要时间,我在输出中得到了这个:输出
  • 几秒钟后我得到这个
  • 在 Azure 诊断工具应用程序事件日志中,我可以看到以下 list(我试过几次)
  • 我猜列表中的两个条目是相关的,首先是 RDB connected,第二个 应用程序已关闭
  • restart service at azure, did this many times. Also tested with stopping service and start manually again.
  • immediatly press shortcut for reattach to process because i want to watch ConfigureServices method.
  • it connects successfully
  • shows nothing, means not ending up in any breakpoint
  • May I be to slow? Do not think so and "Thread.Sleep || Task.Delay" are not helping for catching up any Breakpoint..
  • after beeing connected it takes almost no time and i get this in my Output: Output
  • After few Seconds I get this
  • Within Azure Diagnostic Tools Application Event Logs I can see following list (I tried several times)
  • Two entries from list are relevant as i guess, first says RDB connected, second that application has shutdown

顺便说一下,本地调试工作正常!有什么建议可以在哪里找到其他日志信息或这里发生了什么?

Local debugging works fine by the way! Any suggestions where to find additional logging information or what is going on here?

我刚刚在 VS2019 的 Cloud Explorer 中发现了一些额外的日志记录.在 eventlog.xml 中,我可以看到许多事件说 调试器已经连接

I just found some additional logging in the Cloud Explorer of VS2019. in eventlog.xml I can see many events saying debugger already connected

也许有人可以帮助我走得更远.否则我将在我的解决方案中设置一个新项目,也许我破坏了某些东西,并创建一个新的 azure 服务来清理这些组件.谢谢各位!

May be anybody can help me getting further. Otherwise I will setup a new Project in my solution, maybe i broke something, and create a new azure service to have those components clean. Thank you guys!

更新:现在我在azure上新建了一个服务,在VS2019中新建了一个项目,没有任何改进.我也尝试使用 View 检查一个新项目,并尝试通过抛出异常来查看代码执行的程度,并且它似乎在整个启动类中都没有问题地执行,只是远程调试似乎无法正常工作,因为远程调试器已经已连接.

Update: Now I created a new service at azure, Set up a new project in VS2019 and no improvement. I tried to check against a new project with View too and tried to see how far code is beeing executed by throwing exceptions and it seems to be executed with no problems through whole startup class, just the remote debugging seems not working because of remote debugger already connected.

推荐答案

此问题可能是由于启用了使用托管兼容模式"引起的.
解决方法:

This issue may be caused by having 'Use Managed Compatibility Mode' enabled.
To workaround:

  1. 列表项
  2. 工具->选项
  3. 转到调试->常规
  4. 向下滚动到列表底部并取消选中使用托管兼容模式"
  5. 重新开始调试

Web.config 文件中 compilation 元素的 debug 属性必须设置为true".

The debug attribute of the compilation element in your Web.config file must be set to "true".

<system.web>  
<compilation debug="true" targetFramework="*.*" />  
<httpRuntime targetFramework="*.*" />  
</system.web>  

这意味着,您必须进行调试"构建或手动编辑 **Web.config** 文件.

This means, you either have to do a 'Debug' build or manually edit the **Web.config** file.

请确保在远程调试时将您的 IP 地址添加到防火墙规则中.

Be sure to add your IP Address to the firewall rules while you are debugging remotely.

这篇关于.net5 Azure Web App 断开连接无法正常调试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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