ServiceRoute issues in 1.4 ?

Topics: Troubleshooting, Writing modules
Feb 27, 2012 at 12:16 PM
Edited Feb 27, 2012 at 12:25 PM

Somehow my current working code doesn't work in the latest branch for 1.4

When i set a breakpoint in my ServiceHostFactory isn't doesn't get a hit when browsing to ~/issue/wstrust

This is a part of my code in 1.3

        private static ServiceRoute _tokenService = new ServiceRoute(
            "issue/wstrust", 
            new TokenServiceHostFactory(), 
            typeof(TokenServiceConfiguration));
        public IEnumerable<RouteDescriptor> GetRoutes()
        {           
            return new[] 
            {
                new RouteDescriptor
                {
                    Priority = -1,
                    Route = _tokenService
                }
            }}
  
  public class TokenServiceHostFactory : OrchardServiceHostFactory {
        public TokenServiceHostFactory()
            : base() {
        }
        public override ServiceHostBase CreateServiceHost(string constructorString, Uri[] baseAddresses)
        {            // breakpoint here isn't being hit
            var host = (WSTrustServiceHost)base.CreateServiceHost(constructorString, baseAddresses);            // alot of more code...
          }
    }
Instead i get a Page not found
Coordinator
Feb 27, 2012 at 6:51 PM

Can you give it a higher priority ? Like 100 to test.

Feb 27, 2012 at 7:40 PM
I did, made it 1000 but only the constructor get hit and not the breakpoint at the method
--
Verzonden van mijn Android telefoon met K-9 Mail.

sebastienros <notifications@codeplex.com> schreef:

From: sebastienros

Can you give it a higher priority ? Like 100 to test.

Coordinator
Feb 27, 2012 at 7:54 PM

You mean GetRoutes is never called ?

Feb 27, 2012 at 8:47 PM
GetRoutes is being called. Uh, i assume it is, but i have to test that out tomorrow too be sure.
--
Verzonden van mijn Android telefoon met K-9 Mail.

sebastienros <notifications@codeplex.com> schreef:

From: sebastienros

You mean GetRoutes is never called ?

Coordinator
Feb 27, 2012 at 8:53 PM

Then you can also check why no route is found when ShellRoute.GetVirtualPath is called.

Feb 28, 2012 at 8:16 AM
Edited Feb 28, 2012 at 8:17 AM

I found 2 places where routeProviders are queried.

1) In DefaultOrchardShell

Within the private variable _routeProviders i see my routeprovider but somehow it's just not being hit by the 'obsolete' method GetRoutes() 
Even worse, there breakpoint in GetRoutes method shows a yellow mark "The breakpoint will not currently be hit. No symbols have been loaded". The problem might be there?

public class DefaultOrchardShell : IOrchardShell {

  public void Activate() {
    _routePublisher.Publish(_routeProviders.SelectMany(provider => provider.GetRoutes()));
    _modelBinderPublisher.Publish(_modelBinderProviders.SelectMany(provider => provider.GetModelBinders()));

2) In Orchard.Alias.Implementation.DefaultAliasService

The class is being constructed 'twice' and the _routeDescriptors variable is "Lazy".
But the breakpoint in the GetRouteDescriptors method hasn't been hit.

 

I'm a bit clueless atm and all i know something with routes changed in 1.4 which broke the ServiceRoute functionality

Feb 28, 2012 at 8:50 AM
Edited Feb 28, 2012 at 10:00 AM

I explicitly implemented it the IRouteProvider interface and i could set my breakpoint there. I see my routeDescriptor being 'published' inside the _routeCollection variable within Orchard.Mvc.Routes.RoutePublisher.

But that's it.. a breakpoint in GetVirtualPath and a watch on criteria for my routeDescriptor shows me it isn't being found. 

So GetRoutes is called, but GetVirtualPath doesn't find my route.

The GetVirtualPath get 3 hits (is that 1 foreach ServiceRoute??)
In the values i see Logon Account and the url of my serviceroute.
Might  be some login redirect related problem?


In total i've around 124 routes registered, 1 route is a ignore route, 120 routes are web.routes and 3 routes are ServiceRoutes

I did set a BreakPoint in the ShellRoute.GetRouteData and the hit count reaches is 120

Ok i'm again clueless where to search now lol

Apr 2, 2012 at 8:44 AM
Edited Apr 2, 2012 at 9:31 AM

I have this same problem now. My registered ServiceRoute doesn't seem to be called (Page not found)

 

edit: Could this fixed with the changes from a1f00fd194b8 ?

edit2: Looks like I got further now :D

May 23, 2012 at 9:01 AM

I have the same problem but in my case not for a service but just an ordinary controller and action. see http://orchard.codeplex.com/discussions/356664