vb.net 调试时无法对 ASP.NET 代码进行更改

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/22980997/
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-09-17 17:20:07  来源:igfitidea点击:

Unable to make changes to ASP.NET Code Behind while Debugging

asp.netvb.netvisual-studio-2012

提问by Vignesh Kumar A

I've created a new ASP.NET Web Application for my project. While debugging, Visual Studio is not allowing me to make changes to my code behind (default.aspx.cs).

我为我的项目创建了一个新的 ASP.NET Web 应用程序。在调试时,Visual Studio 不允许我更改我的代码(default.aspx.cs)。

When I try, I get the "Edit and Continue" dialog letting me know that "Changes are not allowed while code is running or if the option 'Break all processes when one process breaks' is disabled.

当我尝试时,我收到“编辑并继续”对话框,让我知道“在代码运行时不允许更改,或者是否禁用了‘在一个进程中断时中断所有进程’选项。

but I'm able to edit my default.aspx

但我可以编辑我的default.aspx

Am I missing an option somewhere?

我在某处错过了一个选项吗?

回答by Hugh Webber

I know exactly what you mean. Turn off"Enable Edit and Continue" setting (in tools->options->debugging->general). Now you can edit .aspx.cs Content while it's debugging on Local IIS.

我确切地知道你的意思。关闭关闭“启用编辑并继续”设置(在工具- >选项- > debugging->一般)。现在,您可以在本地 IIS 上调试 .aspx.cs 内容时对其进行编辑。

回答by SpiderCode

You are allowed to changes ASPXpage because this page is going to be rendered at client side and changes made in page will be directly affected to client browser.

您可以更改ASPX页面,因为此页面将在客户端呈现,页面中所做的更改将直接影响到客户端浏览器。

But When you change in CodeBehindvisual studio will not allow to change the code because your code needs to be compile again and dll generated to your application needs to be created again with the updated code. That is why it will not allow you to change it.

但是当您在CodeBehind 中更改时,visual studio 将不允许更改代码,因为您的代码需要再次编译,并且需要使用更新后的代码再次创建为您的应用程序生成的 dll。这就是为什么它不允许你改变它。

If you want to change code, you will have to stop the application, change code and run the application again.

如果要更改代码,则必须停止应用程序,更改代码并再次运行应用程序。

If you want to change the value of defined variable at debug time then you can directly change it by moving cursor on it and reassigning value.

如果要在调试时更改已定义变量的值,则可以通过将光标移动到其上并重新分配值来直接更改它。

Another option to change the value of variable at debug time is from Immediatewindow.

在调试时更改变量值的另一个选项是从立即窗口。

If you still want to update the code then follow below steps :

如果您仍想更新代码,请按照以下步骤操作:

  1. Right Click on the Project
  2. Select Properties
  3. Select Web in Right Panel
  4. Check 'Checkbox' at the bottom saying : 'Enable Edit and Continue'
  1. 右键单击项目
  2. 选择属性
  3. 在右侧面板中选择 Web
  4. 检查底部的“复选框”说:“启用编辑并继续”

Refer : http://blogs.msdn.com/b/visualstudioalm/archive/2013/06/26/debugging-support-for-64-bit-edit-and-continue-in-visual-studio-2013.aspx

参考:http: //blogs.msdn.com/b/visualstudioalm/archive/2013/06/26/debugging-support-for-64-bit-edit-and-continue-in-visual-studio-2013.aspx

回答by Jaime García Pérez

Probably you need to change this when running and debugging multiple projects at the same time:

在同时运行和调试多个项目时,您可能需要更改此设置:

Break All Processes When One Process Breaks

当一个进程中断时中断所有进程

http://blogs.msdn.com/b/zainnab/archive/2010/10/22/break-all-processes-when-one-process-breaks-vstipdebug0029.aspx

http://blogs.msdn.com/b/zainnab/archive/2010/10/22/break-all-processes-when-one-process-breaks-vstipdebug0029.aspx

Perhaps yesterday, you was working only with one project and today you are debugging multiple projects. Thats the difference.

也许昨天,您只处理一个项目,而今天您正在调试多个项目。这就是区别。

Anyway, first answer is good too.

无论如何,第一个答案也很好。