Debugging Web Apps in Visual Studio 2010 Is Annoyi

2019-09-05 13:05发布

I just starting working with Visual Studio and I find that debugging web apps is rather annoying. After making a change and clicking f5 it sends you to localhost:port/ however many times you are not editing localhost:port/ but you are editing localhost:port/someOtherFile, so you can see how this can be pretty annoying.

I am hoping that there is a way to optimize this. Ideally I would want to be able to hit f5 and have it just refresh whatever tab in my browser has localhost:port/whatever/youGetThePoint If this is possible it would make for some really nice debugging because many times you would never even have to click the browser.

Also, why do we have to hit shift+f5 to stop debugging. Why not just f5...

EDIT: I am using MVC2

5条回答
疯言疯语
2楼-- · 2019-09-05 13:38

I believe Start Options might do the trick for you.

Right-click on the project, and select "Start Options..."

On the Start Options dialog under "Start action" heading, you may specify a page or start URL.

查看更多
干净又极端
3楼-- · 2019-09-05 13:41

Two things you can do:

You can set your web application to use your local IIS for debugging. I'm assuming you're using the standard settings that get setup whenever you create a new web app project.

To set your project to use IIS first make sure you have IIS installed on your dev machine. Select the web application project from the Solution Explorer and then right click. Hit the properties selection. The first tab on the right (build), should allow you to configure IIS to have an application for your project. It will eliminate the port number part and should be a bit easier to navigate around in.

Second thing you can do is find the page you want to go directly to and right click on it and set it as the start page ("Set As Start Page").

Also, you can Google for a Visual Studio macro that will attach to the IIS worker proc so you don't have to refresh what the browser is currently doing. You can also go to the debug menu item and select "Attach to Process..." and then find the worker proc and attach to it.

查看更多
Fickle 薄情
4楼-- · 2019-09-05 13:43

In Visual Studio, right click on the file (Mypage.aspx -?) you want to start debugging with and select "Set As Start Page."

This will automatically open that page instead of root.

查看更多
虎瘦雄心在
5楼-- · 2019-09-05 13:48
  1. Click on your application in the solution manager
  2. View -> Property Pages
  3. Select the 'Web' tab on the left
  4. Set 'Start Action' to a specific page.
查看更多
走好不送
6楼-- · 2019-09-05 13:51

You can select any page in the web project to be the startup page - once you click F5, the browser will start at that page.

查看更多
登录 后发表回答