Snowy
Snowy

Reputation: 6122

Console App Host ASPX Page?

In Framework 4.0 I have a little console app. I have a self-contained .aspx page (no codebehind) and would like to run the console app just to host this page. I searched around for tricks with System.ServiceModel.Web or System.Web.Services trying to find a way to do this.

Can anyone help me get clue?

Thanks.

Upvotes: 4

Views: 1353

Answers (2)

Coffee_fan
Coffee_fan

Reputation: 21

The easiest way to host ASP.NET on a simple web server is to use the Cassini web server, which you can download from MS, including source code. The following two links help:

After downloading, the only things you need to do are:

  1. Comment out lines 92 through 96 of request.cs such that Cassini does not discard requests coming from hosts other than localhost.
  2. Run build, which builds and installs the Cassini library into the GAC.
  3. Run the server.

Note: Cassini is a Console app, which just happens to show a form. If you're interested in it working purely as a Console app, refactor and remove the form. It should not be hard.

Upvotes: 2

Onkelborg
Onkelborg

Reputation: 3997

Have you seen this article? It's not written for asp.net 4.0, it's written for asp.net 2.0, but I don't think there's much difference.

Upvotes: 3

Related Questions