简体   繁体   English

ASP.NET开发服务器无法清除值?

[英]ASP.NET Development Server not cleaning up values?

I have a string which I declare as "" at the start of a method. 我有一个在方法开始时声明为“”的字符串。 I've set up breakpoints each time the string is used. 每次使用字符串时,我都会设置断点。 The first time I debug the app, it rightly stops at where I declared the variable. 第一次调试应用程序时,它恰好在声明变量的位置停止。 Then I stop debugging, try debug again, and it doesn't stop where the variable is declared - it stops at where I am supposed to be giving it a value for the first time (except it already has a value according to VS debugger!!). 然后,我停止调试,再次尝试调试,它并没有在声明变量的位置停止-它在我应该第一次为其赋值的位置停止(除非它已经根据VS调试器提供了值! !)。 It's not just when I debug, it's when I run the app normally too. 这不仅是我调试的时间,还是我正常运行应用程序的时间。 Restarting ASP.NET Development Server fixes the problem. 重新启动ASP.NET开发服务器可解决此问题。 Anyone have any ideas? 有人有想法么?

Read about static members Static Classes and Static Class Members . 阅读有关静态成员, 静态类和静态类成员的信息 I think you declared static field at global.asax file or somewhere similar. 我认为您在global.asax文件或类似位置声明了静态字段。 Because of it field is initialzed only once at appliaction start. 因此,在应用开始时,该字段仅初始化一次。 When you start/stop/start debugging of application, you not restart application. 启动/停止/启动应用程序调试时,不会重新启动应用程序。 Application restart occurs when you restart ASP.NET Development Server. 当您重新启动ASP.NET开发服务器时,将发生应用程序重新启动。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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