Setting HandlerFactoryPath in TestAppHost results in 404 not found in Integration Tests

Hi @mythz,

I’m experiencing some strange behavior in my integration tests. When I set the HandlerFactoryPath value and run my unit tests I get a 404 response. If I remove/comment out the HandlerFactoryPath setting then it all works. Pretty weird… Here is an example of one AppSelfHost Base that works:

public class TestAppHost : AppSelfHostBase
{
    public TestAppHost()
             : base("Test Container",
             typeof(HelloServices).Assembly)
    { }

    public override void Configure(Container container)
    {
        SetConfig(new HostConfig()
        {
            ApiVersion = "v1",
            WsdlServiceNamespace = "http://schemas.example.com/",
            DebugMode = AppSettings.Get(nameof(HostConfig.DebugMode), true)
        });
    }
}

Here is the version that doesn’t:

public class TestAppHostWithHandlerFactoryPath : AppSelfHostBase
{
    public TestAppHostWithHandlerFactoryPath()
             : base("Test Container",
             typeof(HelloServices).Assembly)
    { }

    public override void Configure(Container container)
    {
        SetConfig(new HostConfig()
        {
            ApiVersion = "v1",
            HandlerFactoryPath = "api", // comment this out and it works
            WsdlServiceNamespace = "http://schemas.example.com/",
            DebugMode = AppSettings.Get(nameof(HostConfig.DebugMode), true)
        });
    }
}

I’ve also created a repro of this here (link)

I couldn’t find anything documented on this so apologies if this is working as intended.

Thank you!

Yeah this works differently in .NET Core, previously custom paths weren’t supported at all in .NET Core now the Custom Path needs to be stripped from the Listening URL and configured as a Path Base (done in .NET Core AppHosts).

Basically requests in .NET Core aren’t included in the Request’s /path/info so the HandlerFactoryPath isn’t needed but I’ve added support for handling it when it is in this commit.

This change is available from v5.1.1 that’s now available on MyGet.

1 Like

@mythz, as always thanks for the quick response to the thread and the speedy code change. ServiceStack is a great example of a well run product, please never change!

1 Like