How to set web folder for debugging in visual studio? - asp.net-mvc

When I am debugging web project in visual studio the web address is for example localhost:1234/index.html, but when I publish project the web address will be like *http://myserver.mydomain.com/myApplication/index.html.
Is there a way to set in visual studio to debug it on localhost:1234/myApplication/index.html.
I am accessing few scripts and css and services and it will make my life easier if they will be on same level during debugging and publishing.

Right click on the project, click Properties Window and add /myApplication as the Virtual Path. Or you can use View->Properties Window from the main menu.

Related

VS2012 Debugger will not open browser when debugging ASP MVC project

I am trying to debug an ASP MVC 4 project in Visual Studio 2012. However, once the code compiles the debugger stops completely, never bringing up the browser. I am able to run ASP.Net projects just fine from this computer, however this project doesn't seem to want to work.
With this project if i click on IIS Express in Notification area so it shows my website and if i click on it so then it opens up my site on browser but by default on debugging with Visual Studio it doesn't open.
I also tried to set my start up project but this also does not work????
Check this setting in your web project's settings and ensure it's not set to "don't open a page"

Opening links in TFS in internal webbrowser in Visual Studio

Visual Studio and Team Foundation Server are highly integrated. The only thing that use another application is when clicking on hyperlinks, such as the Project Portal and Web Access, which opens the link in the default webbrowser.
I would like to override this behavior and open these links in a tab in the internal webbrowser inside Visual Studio.
Is it possible change an option to make Visual Studio open TFS links in the internal webbrowser instead of opening them in the default webbrowser?

Is there any way to make Visual Studio 2010 stop starting my MVC projects?

I have a Visual Studio 2010 Solution that contains a few library projectes, a few WPF projects and an ASP.NET MVC 3 project. When i start any project the MVC project get started in the development-server.
Is there some way to stop this behaviour?
Edit:
I just checked to make sure I´m to doing too much wrong. If you start a new solution with a console/whatever project and add an mvc3 project, everytime you start the console project the mvc project gets started as well.
Not sure if this is buggy or an intended feature, but it is kind of strange that the behaviour is so different from normal projects.
If you don't need MVC project for certain period of time, you can unload it (Right-click on the project and select Unload project).
Another option is to select local IIS as a web server (If you have it installed). This way it won't start development server.
You can always choose another project as the default project to start up. You can right-click on the project and set as startup project.
Make sure all your web projects are set to use local IIS rather than the Visual Studio Development server. Unlike the development server, IIS doesn't do anything with a new build until you actually try to load a page.

How to debug the client side code from within studio?

I am trying to debug the client side code (like JQuery code, JavaScript code) from within visual studio.
Wondering how i can do that?
You have to enable debugging in Internet Explorer. In Internet Options there's an option, checked by default, called "Disable Script Debugging (Internet Explorer)." Uncheck this option and close Internet Explorer.
After that, you can use VS to attach to a running instead of IE and set breakpoints in the code. The full features of VS's debugger will be available and it works great.
In VS 2010 (and VS 2008 I think) while running the web solution in debug mode using internet explorer, if you go into the Solution Explorer there will be a "Script Documents" node, with an "Internet Explorer" node beneath this and all the java scripts that are in the page will be listed. You can double click on any of these scripts to open them and add breakpoints to the java script as required.
FireBug is much better javascript debugging tool compared to Visual Studio. I would strongly recommend it to you. Google Chrome developer tools are also worth checking.

In Visual Studio 2010, how do you invoke the "View In Browser" feature on an MVC app?

In Visual Studio 2010, you can right-click an aspx page in a web forms app, or on the web forms app itself in the solution explorer, and you get "View in Browser" in your context menu.
In ASP.NET MVC projects, this item doesn't seem to be available in the context menu. The only way I know to run the app is to set the MVC app as a startup project and hit CTRL+F5. But, if there are two MVC apps in the solution, this doesn't really work. How do you accomplish this for mvc apps?
You really can't.
Routes are determined at runtime. There is no way for Visual Studio to know what View its going to use until routes are added, controller actions are hit and the ActionResult is executed.
You can configure your web applications to use IIS so you don't have to hit F5 to run them. The IIS process will automatically start the web site for you. It's such a time saver!
Right click a web project and choose Properties
Go to the Web tab and choose the "Use Local IIS Web server" option.
Enter a url like http://localhost/MyProject
Rebuild.
Navigate your browser to the url you entered.
If you want to debug your website, you can go to Debug > Attach to process..., then attach to w3wp.exe. This will attach to all web apps within your solution. (You might have to select the show processes from all uses option.) If you've just rebuild, you have to reload the site before IIS recycles and the breakpoints turn solid red. (If the breakpoints are ever only outlined in red that means the code running in IIS is an older build than what you are seeing. In rare cases you may have to kill the IIS process, but cleaning and rebuilding usually clears this up for me.)
Note: you'll probably have to go into Window's Programs and Features control panel and enable the IIS features. VS should prompt you if these aren't configured already.

Resources