Launching the ASP.NET Configuration web site outside of Visual Studio (using Cassini)
Some of you .NET heads out there will probably ask: "So Phil, why would I care to launch the config tool without Visual Studio? I live and breath inside Visual Studio." Well, the answer is, that you might not want to launch it, but your non-programming buddy the System Administrator who has the priviledge and the burden of maintaining user security is very likely to want to do this.
I'll keep this post short and sweet. Here's an example batch file I wrote (that must be run on the web server hosting the ASP.NET 2.0 application to be configured).
@echo off
SET FrameWorkFolder=C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727
SET VFolder=Asp.NetWebAdminFiles
SET Port=8099
SET App=/Portal
SET AppPath=C:\Projects\SIS\Portal\
explorer "http://localhost:%Port%/%VFolder%/default.aspx?applicationPhysicalPath=%AppPath%&applicationUrl=%App%"
%FrameWorkFolder%\WebDev.WebServer.EXE /port:%Port% /path:%FrameWorkFolder%\%VFolder% /vpath:/%VFolder%
Here are the basic ideas exemplified above:
- Be considerate to those (other than you) who will be supporting your ASP.NET 2.0 web site. Give them a way to maintain site security.
- Since the Cassini web server is built into the .NET 2.0 framework (as WebDev.WebServer.EXE), we can auto-launch any disk folder as a web site.
- Since the ASP.NET Configuration web site is stored in the C:\Windows\Microsoft.NET\Framework\v*\Asp.NetWebAdminFiles\ folder, we can simply launch a local web site through Cassini to host it for us.
- The ASP.NET Configuration web site's default web page requires two parameters:
- applicationPhysicalPath (which should point to your ASP.NET 2.0 web site root folder on the hard disk)
- applicationUrl (which should be your appname as found in your aspnet database's aspnet_applications table)
- Since the command to launch Cassini is a blocking process, the WebDev.WebServer command must be last in the batch file. This means that we must launch the browser prior to bringing up the Cassini site. It all seems to work out fine for me. Perhaps on other people's machines the timing will not work out so conveniently.
Cheers.