Rajeeshcv.com

Sharing my knowledge


Attach to Any ASP.NET Web Server from Visual Studio in One Click

Posted on: 30 Nov 2011 | Filed under: VisualStudio, ASP.NET, .NET | comments (3)

This is an update to my previous blog post Attach to Visual Studio Development Server with One Click.

The Visual Studio Macro from previous article doesn’t support IISExpress or IIS; it only supported the Visual Studio Development Server, more over it doesn’t detect latest Development Web Server “WebDev.WebServer40.exe”.

Now I have updated the Macro so that it will automatically detect the Web Server setting from the project properties and attach it accordingly.

Read more...

Attach to Visual Studio Development Server with One Click

Posted on: 26 Nov 2011 | Filed under: ASP.NET, .NET, VisualStudio | No comments yet

Update: Enhanced version of the Macro created here is available in the new article -  Attach to Any ASP.NET Web Server from Visual Studio in One Click

In my day to day work, during the development I had to attach an ASP.NET application to the development server (Cassini) several times in order to debug and fix a problem.

This task is little bit time consuming because this is how we normally do it

  1. Click on the “Attach to Process” menu under the Debug menu
  2. Select the correct process from the list of available processes
  3. Either double click on the select process or click the “Attach” button

You can reduce these into two steps, if you assign a short cut key to the “Attach to Process” command.

What I found is most of the time is lost in finding and selecting the correct process from the available list of processes in the “Attach to Process” dialog.

Read more...

Multiple visual studio development servers while debugging

Posted on: 24 Nov 2011 | Filed under: .NET, ASP.NET | No comments yet

You might have noticed that when you start debugging an ASP.NET web application, it start more than one visual studio development servers and in the system tray you see something like this

Mutiple_development_server

This happens when your solution contains more than one web application, setting one as the StartUp project is not going to help..

The reason for this is - by default any web application is set to start when we trigger the debugging process in visual studio. We need to disable that auto start feature so that only one visual studio development server is getting started when we are debugging.

These are the steps for disabling it

  1. Select the web project which you don’t want to start
  2. Go to the properties window (Shortcut – press F4)
  3. Set “Always Start When Debugging” to False

Disable_Start_When_Debuggin

This is how you could do it in Visual studio 2010, I hope the same applies to Visual studio 2008 too. Now if you start debugging, you will see only one development webserver.

Hope this helps


Stay away from Request.Url

Posted on: 30 Oct 2011 | Filed under: .NET, ASP.NET, MVC | comments (1)

The title might be misleading but I will explain why we shouldn’t use the Request.Url in any asp.net application directly.

If you are writing an web application and you don’t where it is going to be deployed, environment of the server where it is getting deployed, then it is better not to use Request.Url it directly.

image

This blog is running on a home grown blog engine, which is written using asp.net MVC 3. For implementing some of the functionalities like generating sitemap.xml I had to get the root of the url(i.e. without any path). So I used the Request.Url.GetLeftPart(UriPartial.Authority) method and it worked perfectly on my local machine even when it is deployed my local machine IIS server. When I deployed my blog engine to Appharbor environment, the generated sitemap.xml has a URL with port number like http://www.rajeeshcv.com:4566 instead of just http://www.rajeeshcv.com.

Read more...