News

Laurent Kempé MVP
PDC 2008

Contact

My status

View Laurent Kempé's profile on LinkedIn
XING
twitter
facebook


Xbox 360



Map

Locations of visitors to this page

.NET Dudes

Family

French .NET Dudes

Friends

Links

Tech Head Brothers

Starting ASP.NET Development Server from a right click in explorer

Update: Following the comment of Jon Galloway

I know that there are other solutions doing this but I was just asked about how to do it today (hey Christine ;) and had this registry file stored somewhere for a while waiting for a blog post.

Save this to a file with an extension .reg, e.g. "asp.net web server here.reg":

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\VS2005 WebServer]
@="ASP.NET 2.0 Web Server Here"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\VS2005 WebServer\command]
@="C:\\Windows\\Microsoft.NET\\Framework\\v2.0.50727\\Webdev.WebServer.exe /port:9081 /path:\"%1\""

You might also change the port used to start the ASP.NET Development Server. If this option is not specified then the port 80 is used.

Then double click on the .reg file to save the settings in the registry.

Now you will have access to the following right click menu in explorer and you can browse your site without running Visual Studio:

Update: This is not needed anymore

You will need to copy hstart.exe to your C:\Windows\system32\ first, or change the path used in the .reg file. This little tool (3kb); Hidden start, by NTWind Software is really good for "small startup manager that allows console applications to be started without any windows in the background.". Exactly what is need in our case.

Comments

Robert McLaws said:

I actually built a tool for this a while back. The problem with using this approach is that the port is always the same, meaning that it could potentially be guessable and hacked. My version installs an executable that wraps the ASP.NET web server to generate random port numbers on every launch.

You can find my app here: www.robertmclaws.com/.../entry5.aspx

# July 6, 2007 12:33 PM

lkempe said:

Robert: The tool here is doesn't need any setup and the used tool is 3Kb so it is ok for me. The argument of hack is not relevant bfor me because I have a firewall that close the ports on my machine.

# July 6, 2007 12:49 PM

Jon Galloway said:

Cool!

I changed it to remove the HSTART dependency. I don't see any flicker at all, since it starts the server without launching a command window.

The port number is an optional parameter, so if you want dynamic ports you can just leave the "/port:9081" part out. It defaults to port 80, but if you've got IIS running then it'll find an unused port.

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\VS2005 WebServer]

@="ASP.NET 2.0 Web Server Here"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\VS2005 WebServer\command]

@="C:\\Windows\\Microsoft.NET\\Framework\\v2.0.50727\\Webdev.WebServer.exe /port:9081 /path:%1"

# July 6, 2007 3:21 PM

Jesse Foster said:

I didnt think the dev webserver would serve external requests.

# July 6, 2007 5:02 PM

lkempe said:

Jesse: you are right it should not server something else than localhost

# July 6, 2007 6:29 PM

lkempe said:

Jon: You are right the usage of hstart is not needed at all, but what you are saying about port 80 isn't true, it will not search for another port, it just says that the port is used.

And btw you are missing quotes around %1, in your case it would not work if there is a space in the path you try to run so the correct file content is

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\VS2005 WebServer]

@="ASP.NET 2.0 Web Server Here"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\VS2005 WebServer\command]

@="C:\\Windows\\Microsoft.NET\\Framework\\v2.0.50727\\Webdev.WebServer.exe /port:9081 /path:\"%1\""

# July 6, 2007 6:38 PM

ASP.NET 2.0 Web Server From Here « .NET i takie tam said:

Pingback from  ASP.NET 2.0 Web Server From Here « .NET i takie tam

# July 12, 2007 5:02 AM

Laurent Kempé said:

I am currently working with Silverlight and Silverlight Streaming and had an issue over the weekend I

# September 11, 2007 7:04 PM

Eric Boerboom said:

I couldn't get the ASP .NET development server running, but now with the reg key it's working.

Thanks for the help, it's much appreciated!

Eric

# December 27, 2007 9:32 AM

codehat said:

The link above to Robert McLaws site does not work

# May 1, 2008 7:25 PM
Leave a Comment

(required) 

(required) 

(optional)

(required)