500 Internal Server Error - Multiple actions were found that match the request: core/pa on type Pineapples.Controllers.LookupsController

Issue #42 resolved
Ghislain Hachey created an issue

Getting following error when trying to access:

  • xychart
  • Schools/[List/Chart/Table]
  • Teachers/[List/Chart/Table]

I can't find a route on the backend /api/lookups? I only see two routes in LookupsController.cs (/api/lookups/collection/core? and /api/lookups/collection/pa? both work.) If I replay it in fiddler and replace /api/lookups? with /api/lookups/collection/core? then I don't get the error and JSON data is returned.

HTTP/1.1 500 Internal Server Error
Cache-Control: no-cache
Pragma: no-cache
Content-Type: application/json; charset=utf-8
Expires: -1
Server: Microsoft-IIS/10.0
X-AspNet-Version: 4.0.30319
X-SourceFiles: =?UTF-8?B?QzpccGluZWFwcGxlc1xQaW5lYXBwbGVzXGFwaVxsb29rdXBz?=
X-Powered-By: ASP.NET
Date: Tue, 05 Apr 2016 09:03:22 GMT
Content-Length: 765

{"Message":"An error has occurred.","ExceptionMessage":"Multiple actions were found that match the request: \r\ncore on type Pineapples.Controllers.LookupsController\r\npa on type Pineapples.Controllers.LookupsController","ExceptionType":"System.InvalidOperationException","StackTrace":"   at System.Web.Http.Controllers.ApiControllerActionSelector.ActionSelectorCacheItem.SelectAction(HttpControllerContext controllerContext)\r\n   at System.Web.Http.Controllers.ApiControllerActionSelector.SelectAction(HttpControllerContext controllerContext)\r\n   at System.Web.Http.ApiController.ExecuteAsync(HttpControllerContext controllerContext, CancellationToken cancellationToken)\r\n   at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__1.MoveNext()"}

Comments (17)

  1. Ghislain Hachey reporter

    I have pulled all latest changes, done a clean and rebuild. Still seeing the exact same errors. I'm also not receiving emails from bitcket for some reason. I have tried adding another email to see.

  2. Brian Lewis repo owner

    After you pull down the latest source, be sure to go into Pineapples.Client, open the Task Runner Explorer Window and run the grunt task _build_deploy.

    this is a combination of the build and deploy tasks. It will - compile all the typescript to tscompile.js

    • combine all the javascript source with the compiled types script to make scripts\app\pineapples.js

    • extract all the required js and css from bower_components (reading bower.json) and copy these to \scrips\vendor and styles\vendor

    • copy all of \scripts and all of \styles from Pineapples.Client to Pineapples, from where it is loaded to the client.

    I'm suspecting your js source is not changing....?

  3. Ghislain Hachey reporter

    OK, a couple of things

    • First, I made some assumption about the development process which were wrong. I thought changes in the Client would be automatically reflected in development. Typically I have a watch task on JS folders and a automatic build task on changes which runs lint, tests and compile before serving unminified version by a HTTP development server. Then a final deploy task to do the final concat and minification and ideally ability to stream into production should all test pass. Just some thoughts out loud. I think there is lots of room for improvement on DevOps here, or maybe I don't yet understand the setup well enough?!

    • Second, it seems to be better now, a little. Now I still get the same error when I visit School/List but if I change the top filter then it will pull data and display. The same is true for teachers. It's as if somehow the data from filter is not ready to display table when first accessing Teacher/List or School/List. Chart links are not working at all and nothing in the filters with similar /api/lookup? 500 error but let me pull all latest and make sure things are cleaned up and regenerated from scratch. Then I'll report back and we can figure out what needs to be improved/fixed.

  4. Brian Lewis repo owner

    The Charts and Tables menu options we should remove for now - they are for future use I guess, and have been inherited from the system from whch Pineapples was derived. Capture.PNG

    They use the same data as selected in the list, and aggregate it on 2 selected dimensions.

    This can be shown in a chart, table or choropleth.

    When you go to the List page, you don't get anything displayed until you make a selection. You can either do that through the searcher panel at the top, or using the search in the navigation bar.

    So just to track this down :

    • do you get any calls to api/lookups apart from

    api/lookups/collection/core

    This should get called once at startup. If it fails with a 500 error , it will get called again whenever a code is needed, because the cache is not there.

    When you get to the school searcher screen, do you see contents in the dropdown lists e.g. for selecting province?

    If you get a 500 error on api/lookups/collection/core, please send again from fiddler, in JSON view:

    I think we may have a sql error in there, and it could be database discrepancy - ie a view you don't have.

  5. Brian Lewis repo owner

    On the build process: I experimented a little with wrapping a watcher around the build and deploy but , for me, I didn't feel I would want it so I left it manually driven. It would be good if you could add in to the grunt file in time, with an option to manually start the relevant watchers. Especially when we start linting the js and typescript.

    One point to note about the windows environment is that bundling and minification is handled in ASP.NET, so there's no need to apply that via grunt. You can turn it off or on at the server using web.config. It manages caching and versioning well. At the moment, you dev environment will have that turned off - because you have DEBUG=true here:

    <system.web>

    <compilation debug="true" targetFramework="4.6" />
    
    <httpRuntime targetFramework="4.5" />
    

    </system.web>

    Set debug to false, and you will get B&M turned on.

    this code in indesx.aspx will render the files invidiaully, or bundled:

    <asp:PlaceHolder runat="server">

        <%: System.Web.Optimization.Styles.Render("~/bundle/styles/vendor") %>
    
        <%: System.Web.Optimization.Styles.Render("~/bundle/styles/app")    %>
    

    </asp:PlaceHolder>

    The C# code is in App_start/BundleConfig.cs

  6. Ghislain Hachey reporter

    On 4/7/2016 8:35 AM, Brian Lewis wrote:

    I think there should be a sensible default with a clear indication of how it can be further searched/filtered.

    Yes. The same as in the original screenshot of this issue.

    This would explain why I get the error multiple times as the system is "being used".

    I am not sure what you mean here, I certainly don't see any obvious mean of selecting province. When I click Schools I just get dropdown menu. Then click on List and nothing (see above re sensible default). I do get a dropdown box at the top with label "Show Colums:" containing Location/Latest Survey as options and only when I start selecting those do I get a populated table (and I must start by selecting Latest Survey otherwise nothing happens). Similarly in Teachers, except options in dropdown are Employment/Latest Survey/Latest PA.

    I don't think so (of course I don't known the system so well) but worth investigating. I do not get errors with api/lookups/collection/core only with api/lookups plain and short (with the ? query params)

  7. Ghislain Hachey reporter

    On 4/7/2016 8:52 AM, Brian Lewis wrote:

    So when one executes changes in the Pineapples.Client currently one must manually run grunt build (or _build_deploy) to see changes reflected in development browser page? In any case, I will have a deeper look at all the Grunt task.

    Ok good. So all Grunt has to do it prepare unminified and ASP.NET can take over from there, if I understanding this properly.

  8. Brian Lewis repo owner

    I am not sure what you mean here, I certainly don't see any obvious mean of selecting province.

    oh. that explains a lot.

    Capture3.PNG

    Trust me - we are not wedded to this particular ui feature!

  9. Brian Lewis repo owner

    I don't think so (of course I don't known the system so well) but worth investigating. I do not get errors with api/lookups/collection/core only with api/lookups plain and short (with the ? query params)

    I don't understand what's causing it to even try to access api/lookups or api/lookups?

    Could you post a section of your fiddler log so I can try to get the context from the calls around it?

  10. Ghislain Hachey reporter

    On 4/7/2016 9:29 AM, Brian Lewis wrote:

    OK. I see it now, I apologize for the trouble. I think we can improve UI here to make this a lot more intuitive however. However, the /api/lookups error keeps on popping up and this is clearly still a bug.

    Regarding UI, I have not experimented with the filters yet but I would suggest considering putting those directly on their respective columns in the grid. Or at least within the content area of relevance. In fact, I would opt against putting any sort of filter stuff into the top bar. I would leave top bar for things that a more general and don't change too much. What do you think?

  11. Ghislain Hachey reporter

    On 4/7/2016 9:34 AM, Brian Lewis wrote:

    I could not trace any call to /api/lookups in the client either though I admit I have not yet looked that deeply. Here is a session of fiddler start from a clean no errors "at a glance/primary" to School/List (without trying any filtering yet).

    Would you prefer an actual export of those sessions? Any preferred format?

    -- GH

  12. Brian Lewis repo owner

    Sorry for delay picking this up again - any joy?

    If you want to send your Fiddler log use File - Save- All Sessions as SAZ.

    Note you can use the Filters tab in Fiddler to filter what actually gets intercepted by the proxy server.

  13. Ghislain Hachey reporter

    On 4/12/2016 8:42 AM, Brian Lewis wrote:

    No, I am actually just documenting carefully all features and mapping them to RMI needs as closely as possible. I'll be digging in more soon starting with minor enhancement we all approve and slowly getting down to heavier stuff.

    Sorry, I thought I had attached a screenshot of fiddler. Here is a sample session. I do get a auth refused even if I am logged in though I have seen that /api/lookup 500 error without the auth login 401 error as well.

    Edit: It seems sending images and attachment by email don't make it here. Here is two fiddlers: one with a auth login error (even if already logged in) and other one on a fresh rebuild, login without the auth error but still the /api/lookup error.

    -- GH

  14. Brian Lewis repo owner

    This got fixed in commit ca6e57c0 in LookupsController.cs by annotating the route explcitly on the method.

    Can we marked this resolved?

  15. Ghislain Hachey reporter

    I have not seen this error for a good while, so yeah I think this can be considered resolved.

  16. Log in to comment