ServiceStack Self host static file paths


I have a self host web server, I am having issues loading static content for the web page. Is there a event that I can signup to that can give me the hint to what path ServiceStack is trying to load the file from?


There’s no event, but ServiceStack is just going to try serve the file from:

var file = HostContext.ResolveVirtualNode(httpReq.PathInfo, httpReq);

Which you can potentially simulate by hijacking the request and returning the StaticFileHandler yourself:

appHost.RawHttpHandlers.Add(req => MyShouldHandleRequest(req) 
    ? new StaticFileHandler(req.GetVirtualNode())
    : null

For some reason StaticFileHandler can’t find the files in the debug directory. The path to the files is correct but still none of the files are returned.

See if you have [any StartupErrors in ?debug=requestinfo][1], also the VirtualPathProvider should show the path the FileSystemVirtualPathProvider is configured to look at.

Something else you can try is [changing the physical path][2] to look at your project folder (instead of the /bin folder where it’s run), e.g:

SetConfig(new HostConfig {
    DebugMode = true,
    WebHostPhysicalPath = "~/../..".MapServerPath(),


My static files are in …\bin\debug\app\ folder, In console I see that the message is that WARN: Static File ‘/app/index.api.js’ not found in path: /app/index.api.js.

FileSystemVirtualPathProvider: C:\SomeService\bin\Debug

What could be wrong?

here is debug data if that helps

“Usage”:“append ‘?debug=requestinfo’ to any querystring. Optional params: virtualPathCount”,
“HostType”:“SelfHost (AppHost)”,
“StartedAt”:“2017-05-09 03:11:11”,
“Date”:“2017-05-09 03:14:22”,
“Accept”:“text/html, application/xhtml+xml, image/jxr, /”,
“Accept-Encoding”:“gzip, deflate”,
“Cookie”:“ss-pid=DxA097v2agyJKldOdqxh; ss-opt=temp; X-UAId=0”,
“User-Agent”:“Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36 Edge/15.15063”

“RequestAttributes”:“Localhost, InSecure, HttpGet”,
“Ipv4Addresses”:“XXX.XXX.XXX.XX/,, XXX.XXX.XXX.XX/,”,


“VirtualPathProvider”:"[FileSystemVirtualPathProvider: C:\SomeService\bin\Debug], [ResourceVirtualPathProvider: SomeService.Host], [ResourceVirtualPathProvider: ServiceStack], [ResourceVirtualPathProvider: ServiceStack.Api.Swagger]"


I’m assuming something external in the environment, maybe file permission problems?

Does your file get listed when you add a virtualPathCount? e.g:


Also are you able to download the filter through a service? e.g:

public class DownloadFile 
    public string Path { get; set; ]

public object Any(DownloadFile request)
    var file = VirtualFileSources.GetFile(request.Path); 
    return new HttpResult(file);

then call with:


When I add VirtualPathCount=1000 then the files are listed.