About .NET Dave |  Advertise |  Contact Us |  FAQ |  Link2Me |  Webmasters |  Manage My Submissions
    Cool Stuff |  Hot Stuff! |  Newsletter |  What's New? |  Rotor Source Code
Peter's Data Entry Suite from PeterBlum.com

 Related Directories
 >> HttpHandlers   

  Run ASP.NET outside of IIS website Rate this Resource  0  read reviews write a review report an error printer friendly version
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 ex
Extended Description 
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”

One interesting use of this functionality is to “pre-process” dynamic ASP.NET requests – saving the output as static .htm files that you then prop onto a server. You can do this with MyHost.exe by “pipeing” the output automatically to a static file. For example:

MyHost.exe Test.aspx > Test.htm

using System;
using System.IO;
using System.Web;
using System.Web.Hosting;
public class MyExeHost : MarshalByRefObject {
public void ProcessRequest(String page) {
HttpRuntime.ProcessRequest(new SimpleWorkerRequest(page, null, Console.Out));
public static void Main(String[] arguments) {
MyExeHost host = (MyExeHost)ApplicationHost.CreateApplicationHost(typeof(MyExeHost), "/foo", Directory.CurrentDirectory);
foreach (String page in arguments) {
Time is now: <%=Now%>
  www.eraserver.net  related listings Total Views:5318 | Today:1297 Total Hits:4232 | Today:571

Peter's Data Entry Suite from PeterBlum.com

DotNetNuke Modules

DotNetNuke Modules

ASP.NET User Interface Control Set
  Hosted By:
  Check Out:
  #1 .NET Email
  .NET Email Validation
Back to Top   Last Updated: 8/27/2015 8:05:54 PM
© 2015www.123aspx.com All rights reserved. Terms of Use.   email comments: support@123aspx.com  or use our online form.