Running ASP.NET within a Command-Line .exe (Outside of IIS)
page 1 of 3
Published: 23 Oct 2003
Unedited - Community Contributed
Abstract
This articles demonstrates a simple way to process ASP.NET requests within a command line.
by Scott Guthrie
Feedback
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 33979/ 165
Article Contents:

Overview

One of the more esoteric features of ASP.NET is its ability to run outside of IIS. Specifically, it supports a hosting framework (within the System.Web.Hosting namespace) that enables you to run it on top of other web servers, within command line exes, etc. The below sample demonstrates a simple way to process ASP.NET requests within a command line exe (MyHost.exe). When run, MyHost.exe spins of ASP.NET (threadpool and all) and interprets each parameter to the executable as a URL request to a local file. It then outputs the content back to the console window. To try this out, perform the following steps:

1) Copy The MyHost.cs and Test.aspx files to a local directory

2) Compile MyHost.exe by typing “csc MyHost.cs /r:System.Web.dll” within a command prompt in the directory

3) Type “MyHost.exe Test.aspx”


View Entire Article

Article Feedback

Title:  
Name:  
Url: ( Optional )
Comment:  
Please add 8 and 8 and type the answer here:

User Comments

Title: Invalid URI error   
Name: Sparky
Date: 5/1/2007 9:21:07 PM
Comment:
Hi, I keep getting "Invalid URI" errors when I try your example on either WinXP or Win2000. I'm struggling to find any other examples similar to yours - can you please advise why I'm getting this error?

Product Spotlight
Product Spotlight 






Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2009 ASPAlliance.com  |  Page Processed at 11/21/2009 10:24:10 AM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search