DefaultRedirectPath = "~/ui" redirects to root instead of relative


I am using ServiceStack to deploy to IIS and my SetConfig is as follows:

SetConfig(new HostConfig {
  UseSameSiteCookies = true,
  DefaultRedirectPath = "~/ui"

I was expecting this to redirect to the subfolder / app directory as below:


but the location it is redirecting to is below:


Is there a way to get ServiceStack to redirect to a path that is relative to the deployment location in IIS?

Have you tried /ui?

Yes, I tried /ui first, and then ui and then ~/ui.

It mustn’t be able to resolve the BaseUrl path directly. Is this for .NET Framework or ASP .NET Core?

It is ASP.NET Core 8.0.205 and ServiceStack 8.2.2.

When you want to host an ASP .NET Core App at a custom Path in ASP .NET Core you’d typically use PathBase, e.g:

app.UseServiceStack(new AppHost {
    PathBase = "/MyServiceStackApi",

Which may or may not work when hosting under a Custom Path in IIS, alternatively you can specify a custom base path with by configuring Config.HandlerFactoryPath in your AppHost:

SetConfig(new () {
    HandlerFactoryPath = "/MyServiceStackApi",

Hi @mythz,

Thanks you for your help – I am looking to deploy the application at multiple endpoints in IIS and the PathBase can only be set once (I would need to override it for every endpoint), so this will not work for me.

The HandlerFactoryPath won’t help me as it modifies the path relative to the endpoint (I have used this is the past to host at api when combining with MVC etc).

I think I will have to work around by putting a page at / that will redirect to the ui.

Thanks again for your help!

1 Like

Another potential solution would be to override GetBaseUrl(IRequest) in your AppHost to return the correct Base URL for the incoming request which should be able to support dynamic requests.