MyExeHost.VB
------------------------------------------
Imports System
Imports System.IO
Imports System.Web
Imports System.Web.Hosting
Public Class MyExeHost : Inherits MarshalByRefObject
Public Sub PresscessRequest(ByVal page As String)
HttpRuntime.ProcessRequest(New SimpleWorkerRequest(page, Nothing, Console.Out))
End Sub
Public Shared Sub Main(ByVal arguments() As String)
Dim host As MyExeHost = ApplicationHost.CreateApplicationHost(GetType(MyExeHost), "/", Directory.GetCurrentDirectory)
Dim page As String
For Each page In arguments
host.PresscessRequest(page)
Next
End Sub
End Class
测试页面:
Test.aspx
----------------------------------
<html>
<body>
Hello!World!
Time is now: <%=Now%>
</body>
</html>