For more background, here's my test program, followed by the exception
that gets thrown when I try and GET
http://localhost:9222/test.txt:
-----------------------------------------------
using System;
using OpenRasta.DI;
using OpenRasta.Hosting.HttpListener;
using OpenRasta.Configuration;
namespace ORConsole
{
public class TestHandler
{
public string Get() { return "hello world"; }
}
public class Configurator : IConfigurationSource
{
public void Configure()
{
ResourceSpace.Has
.ResourcesOfType<string>()
.AtUri("test.txt")
.HandledBy<TestHandler>()
.TranscodedBy<OpenRasta.Codecs.TextPlainCodec>();
}
}
public class HttpListenerHostWithConfiguration : HttpListenerHost
{
public IConfigurationSource Configuration { get; set; }
public override bool ConfigureRootDependencies(IDependencyResolver
resolver)
{
var result = base.ConfigureRootDependencies(resolver);
if (result && Configuration != null)
resolver.AddDependencyInstance<IConfigurationSource>
(Configuration);
return result;
}
}
public class Program
{
private static void Main()
{
var h = new HttpListenerHostWithConfiguration
{Configuration = new Configurator()};
h.Initialize(new[]{"http://+:9222/"}, "/", null);
h.StartListening();
Console.WriteLine("Press enter to exit.");
Console.ReadLine();
}
}
}
-----------------------------------------------
-----------------------------------------------
System.InvalidOperationException was unhandled
Message="The pipeline has not been initialized and cannot run."
Source="OpenRasta"
StackTrace:
at OpenRasta.Pipeline.PipelineRunner.CheckPipelineIsInitialized
() in C:\temp\ortrunk\src\core\OpenRasta\Pipeline
\PipelineRunner.cs:line 54
at OpenRasta.Pipeline.PipelineRunner.Run(ICommunicationContext
context) in C:\temp\ortrunk\src\core\OpenRasta\Pipeline
\PipelineRunner.cs:line 90
at
OpenRasta.Hosting.HostManager.<>c__DisplayClass4.<HandleHostIncomingRequestReceived>b__3
() in C:\temp\ortrunk\src\core\OpenRasta\Hosting\HostManager.cs:line
194
at OpenRasta.Hosting.HostManager.ThreadScopedAction(Action
action) in C:\temp\ortrunk\src\core\OpenRasta\Hosting
\HostManager.cs:line 160
at
OpenRasta.Hosting.HostManager.HandleHostIncomingRequestReceived(Object
sender, IncomingRequestEventArgs e) in C:\temp\ortrunk\src\core
\OpenRasta\Hosting\HostManager.cs:line 187
at System.EventHandler`1.Invoke(Object sender, TEventArgs e)
at
OpenRasta.Hosting.HttpListener.HttpListenerHost.ProcessRequest
(IAsyncResult result) in C:\temp\ortrunk\src\core\OpenRasta\Hosting
\HttpListener\HttpListenerHost.cs:line 84
at System.Net.LazyAsyncResult.Complete(IntPtr userToken)
at System.Net.LazyAsyncResult.ProtectedInvokeCallback(Object
result, IntPtr userToken)
at System.Net.ListenerAsyncResult.WaitCallback(UInt32
errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped)
at
System.Threading._IOCompletionCallback.IOCompletionCallback_Context
(Object state)
at System.Threading.ExecutionContext.runTryCode(Object
userData)
at
System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup
(TryCode code, CleanupCode backoutCode, Object userData)
at System.Threading.ExecutionContext.RunInternal
(ExecutionContext executionContext, ContextCallback callback, Object
state)
at System.Threading.ExecutionContext.Run(ExecutionContext
executionContext, ContextCallback callback, Object state)
at
System.Threading._IOCompletionCallback.PerformIOCompletionCallback
(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)
InnerException:
-----------------------------------------------