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


Abstractions can also put you in trouble

Posted on: 19 Nov 2011 | Filed under: NHibernate, .NET | No comments yet

We all have enjoyed the beauty of abstracting out functionality, so that it simplifies the underlying complexity. Sometimes it can come back and hit you on the forehead like a boomerang if we don’t know what is going underneath those hidden layers.

Recently it happened to me with the LINQ provider. If you have a data source then you can build your own Query provider on top of it, so that the users can access your data using the LINQ statements without understand how it is fetched.

For e.g. Linq2Twitter it provides the IQueryable interface which you can use fetch the twitter API without understanding the REST API’s exposed by the Twitter.

Similarly Ayende has created a Linq provider for NHibernate (NHibernate.Linq) which hides complexities of writing Criteria API’s.

This is what happened to me – we had a repository method which is using the NHibernate.Linq and it returned an IQueryable interface of domain model.
Like to the below code(only an example, this is not from the actual codebase itself)

public IQueryable<Customer> QueryableCustomers()
{
    session = SessionFactory.OpenSession();
    return session.Linq<Customer>().AsQueryable();
}

 

In the consumer part (Action method in the controller), we are filtering the customer with a name containing particular string using the Contains method

this.dataProvider.QueryableCustomers().Where(x => x.Name.Contains("custo")).ToList();

 

Everything worked as expected, but one day the filtering stopped working, I couldn’t figure it out initially, but when I looked into the “QueryableCustomers()” method, it has been changed to something like this

Read more...