Currently I am configuring servicestack to operate on subdirectory “/api”, can I have multiple sub-directories registered ?
For example I want servicestack to handle all traffic coming to /api, /services, etc …
Currently I am configuring servicestack to operate on subdirectory “/api”, can I have multiple sub-directories registered ?
For example I want servicestack to handle all traffic coming to /api, /services, etc …
No, you can only host ServiceStack on 1 Custom Path.
You can look at url rewriting in IIS to rewrite urls starting with /services to use /api.
What we do is having different Host projects, but they are deployed to work on diferent URL completely, not a subset… for example:
http://api.domain.com and http://internal.domain.com
We have a WebForm project that each contains only AppHost.cs
and Global.asax
(and the inevitable web.config
) containing:
protected void Application_Start(object sender, EventArgs e)
{
// NHibernate & StructureMap initialization
ServiceLocatorInitializer.Initialize();
#if DEBUG
// NHibernate Profiler
NHibernate.NHibernateProfiler.Initialize();
#endif
// Service initialization
new Api.AppHost().Init();
}
and the AppHost
it self is just a register of what we need for that particular host
public class AppHost : AppHostHttpListenerBase
{
public AppHost() : base("Public REST API",
typeof(CompanyService).Assembly) { }
public override void Configure(Funq.Container container)
{
// your configuration
}
}
it’s not the same as you want, but you can have multiple hosts that actually use the same services… for us it’s a good way to separate the Public API (not so many methods available) from our own Internal API that all our apps consume and have much more methods bases on our own needs.