The RawHttpHandlers
is at #1 in the order of operations doc, however that doesn’t seem the case anymore with v4.5.14 (from v4.5.7)
When looking into Default Redirect issue ( HostConfig.DefaultRedirectPath not working v4.5.14 - #6 by cthames ) it turns out that the Order Of Operations changed.
In that post…
It looks like from debugging that the RawHttpHandler
is not executing before the services registered in the LoadPlugin()
. It looks like it is going directly into the services registered in MyWebAppFeature()
(IPlugin
) which loads a FallbackService
which then HttpError.NotFound
.
// AppHost.Configure(Container container) (full code in above reply)
RawHttpHandlers.Add(httpReq =>
{
if (httpReq.PathInfo == "/")
{
HttpContext.Current.RewritePath(Config.DefaultRedirectPath);
}
return null;
});
LoadPlugin(
new RazorFormat
{
LoadFromAssemblies = { typeof(AppHost).Assembly },
VirtualFileSources = new FileSystemVirtualFiles(Config.WebHostPhysicalPath)
},
new MyWebAppFeature());
In v4.5.7 the RawHttpHandlers
executes before the services registered in LoadPlugin()
(Which loads the FallbackService
)
In v4.5.14 the LoadPlugin()
which loads FallbackService
executes before RawHttpHandlers
which is why the redirect from root isn’t happening anymore.
Is this a bug or what was intended? If it was intended I wish it would have waited until v5 and not a minor release.
Note: I’m trying to put together a sample project for you, but for whatever reason I keep getting:
Error 1 The namespace 'Razor' already contains a definition for '__CompiledTemplate' c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\52d79577\91e8eb6\App_Web_brgjibth.1.cs 15
Granted I haven’t created a new ServiceStack website in a long time.