Fallback route service is called instead of default.cshtml in 4.0.48

I have a working solution with ServiceStack 4.0.46, which is made from the ServiceStackVS AngularJS application template. When I start it, the default.cshtml gets opened and everything works. Today I upgraded this solution and instead of default.cshtml, the application web root opens the fallback service page.

I reverted packages back to 4.0.46 and it works again.

Don’t recall a change here, but it should be calling Fallback Route even on / routes.

Well, there is also https://github.com/ServiceStack/ServiceStack/blob/master/src/ServiceStack/HttpHandlerFactory.cs#L181

Since this is the template from ServiceStackVS, why shouldn’t it work

What’s not working? You’re saying it calls the [FallbackRoute]? but that’s what it’s meant to do. The code you’re referencing only gets hit if the FallbackRoute isn’t a match.

I don’t know how to explain it more.
Steps to reproduce:

  1. Create AngularJS application using ServiceStackVS template
  2. Run it
  3. Observe that instead of the UI (default.cshtml), the snapshot of FallbackForClientRoutes is shown
  4. Downgrade ServiceStack packages to 4.0.46
  5. Run it again and observe that the UI is shown as expected

the snapshot of FallbackForClientRoutes is shown

This is new, I’ll check it out.

Nope I can’t repro it, creating a new project from the AngularJS template is returning the home page as expected:

What’s your environment, i.e. OS, VS.NET version, .NET Framework version, etc.

@mythz I can reproduce with Angular SPA template.

@layoric on what IDE / .NET fx version?

VS 2013 + .NET 4.5 + Win 8.1

The template you’ve shown above is the normal Angular template as opposed to the SPA template.

FallbackRoute is only used in the SPA templates.

Going to ?debug=requestinfo shows what the issue is:

StartUpErrors: [
{
ErrorCode: "PathTooLongException",
Message: "The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.",
StackTrace: "[Object: 11/25/2015 10:13:58 PM]: [REQUEST: ] System.IO.PathTooLongException: The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters. at System.IO.PathHelper.GetFullPathName() at System.IO.Path.NormalizePath(String path, Boolean fullCheck, Int32 maxPathLength, Boolean expandShortPaths) at System.IO.Path.NormalizePath(String path, Boolean fullCheck, Int32 maxPathLength) at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean useAsync) at System.IO.FileInfo.OpenRead() at ServiceStack.VirtualPath.FileSystemVirtualFile.OpenRead() at ServiceStack.VirtualPath.AbstractVirtualFileBase.OpenText() at ServiceStack.VirtualPath.AbstractVirtualFileBase.ReadAllText() at ServiceStack.Formats.MarkdownFormat.<FindMarkdownPages>d__7.MoveNext() at ServiceStack.Formats.MarkdownFormat.RegisterMarkdownPages(String dirPath) at ServiceStack.Formats.MarkdownFormat.Register(IAppHost appHost) at ServiceStack.ServiceStackHost.LoadPluginsInternal(IPlugin[] plugins)",
Errors: [ ]
},

It’s due to the VFS change mentioned in the release notes of removing / prefix from routes. Basically Config.ScanSkipPaths are used to ignore directories like /node_modules/. But it was no longer skipping them due to the / prefix and trying to navigate into node_modules throws an exception when path is greater than 260 chars.

This is already fixed in v4.0.49 on MyGet but you can fix it in v4.0.48 by removing the / prefix from Config.ScanSkipPaths, e.g:

SetConfig(new HostConfig { ... });

for (int i = 0; i < Config.ScanSkipPaths.Count; i++)
{
    Config.ScanSkipPaths[i] = Config.ScanSkipPaths[i].TrimStart('/');
}

Or by re-adding them manually to HostConfig, e.g:

SetConfig(new HostConfig { 
    ScanSkipPaths = { 
      "node_modules/","bin/","obj/","bower_components/", "wwwroot/", "wwwroot_build/"
    }
});

Updated SSVS to 1.0.19. Latest build available here.

Reverted changes to SSVS. Apply one of the fixes above manually in AppHost.cs if using either of the 3 single page templates (AngularJS App, React App or React Desktop Apps (beta)).

@layoric this isn’t ideal, as they won’t know this fix is temporary and can be removed when they upgrade to the next version.

I’ll make it clearer in the Release Notes.

Awesone, thanks, will use the manual fix for now