Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


These support forums are now closed for new topics and comments.
Please head on over to http://eureka.ucommerce.net/ for support.

  • Morten Bock 1867 posts 2140 karma points MVP 2x admin c-trib
    Oct 13, 2012 @ 19:00
    Morten Bock
    0

    ServiceStack REST methods 404 on uCommerce 3.0

    I've been playing around with the fresh uCommerce 3.0 and the new Razor sample site https://bitbucket.org/uCommerce/ucommerce-razor-store/

    The javascript works with some ServiceStack REST methods, that are called on the url's like:

    /ucommerceapi/Json/SyncReply/GetProductVariations

    Those urls give me the generic Umbraco 404, and it seems that there is no config of the servicestack http module in the web.config. Where is the httpmodule supposed to be configured? Should the installer take care of it?

    Any hints? :-)

  • Tim 174 posts 378 karma points
    Oct 13, 2012 @ 19:11
    Tim
    0

    Sorry Morten that's my fault, there's an issue with global.asax in the package.

     

    If you copy over the asax there's also a couple of config setting in the root of the project folder which you'll need. 

     

    I'll write docs shortly

  • Demis J Bellot 1 post 21 karma points
    Oct 13, 2012 @ 19:18
    Demis J Bellot
    0

    I don't know much about Umbraco, but ServiceStack doesn't use any HTTP modules it only uses ASP.NET IHttpHandler mappings to register itself. 

    Since you want to host ServiceStack with an existing WebHost you want include the Web.Config required to host ServiceStack at a custom path, e.g: /api 

    See the Hello World config for an example: http://www.servicestack.net/ServiceStack.Hello/#custompath

    If you're integrating with a Web Framework that uses HTTP Modules than it's possible that they'll choose to hijack all HTTP Requests. ASP.NET MVC is an example that does this. Which is why to get around this you need to add an ignore route rule in the MvcApplication.RegisterRoutes() configuration, e.g:

    Global.asax.cs :: MvcApplication.RegisterRoutes(RouteCollection):

    routes.IgnoreRoute("api/{*pathInfo}"); 

    This tells MVC to ignore routes that starts with /api/* (i.e. where ServiceStack is hosted) and it will fallback to using any of the ASP.NET HttpHandlers registered for that path in the Web.Config. It's likely you'd need to do something similar to get ServiceStack to work in Umbraco, but as I've never used it I'm not sure where that is.

  • Morten Bock 1867 posts 2140 karma points MVP 2x admin c-trib
    Oct 13, 2012 @ 21:48
    Morten Bock
    0

    Thanks Tim and Demis. I copied the Global.asax from the Rozer project source, and added the stuff from the web.config as well, and now I am getting the services metadata and so on :-)

    <add key="umbracoReservedPaths" value="~/umbraco,~/install/,~/ucommerceapi/" />

    and

     <location path="ucommerceapi">
        <system.web>
          <httpHandlers>
            <add path="*" type="ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory, ServiceStack" verb="*"/>
          </httpHandlers>
        </system.web>
    
        <!-- Required for IIS 7.0 -->
        <system.webServer>
          <modules runAllManagedModulesForAllRequests="true"/>
          <validation validateIntegratedModeConfiguration="false" />
          <handlers>
            <add path="*" name="ServiceStack.Factory" type="ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory, ServiceStack" verb="*" preCondition="integratedMode" resourceType="Unspecified" allowPathInfo="true" />
          </handlers>
        </system.webServer>
      </location>

     


     

  • Søren Spelling Lund 1797 posts 2786 karma points
    Oct 17, 2012 @ 11:01
    Søren Spelling Lund
    0

    Also Tim did some docs for setting up the Razor store which include info on the manual steps required for now.

  • henk 2 posts 22 karma points
    Nov 24, 2012 @ 17:00
    henk
    0

    Hi everyone!

    I have a hosted environment where I'm still getting a 404 error message e.g. when trying to add something to the shopping cart. I've double checked the installation steps -- everything is fine: web.config, core.config and all assemblies are there.

    On my local dev machine everything is working fine.

    The hosted environment (where it is hard for me to debug) is running IIS 7.

    Do you have any hints for me?

    Thanks!
    Henk 

  • e 23 posts 42 karma points
    Nov 26, 2012 @ 20:45
    e
    0

    Update: solved!

    I found a reference to this solution somewhere through the mingle of threads I was reading.  Basically, i had to add one line to the AppHost.cs file in the UCommerce.Razorstore project, then rebuild and redeploy:

            public override void Configure(Container container)
            {
                SetConfig(new EndpointHostConfig { ServiceStackHandlerFactoryPath = "ucommerceapi" });

    Once i did that, no more '404' when looking for the handler!

     

    ===== original issue below, for future reference =====

    Apologies if there is a double post, I had a problem when i first tried replying...

    I'm receiving this error as well:

    "NetworkError: 404 Not Found - http:///ucommerceapi/Json/SyncReply/GetProductVariations"

    Additional details if it helps, here is more detail on the post/response per filezilla:

    JSON       
    productSku  
    "BWWMSFSS-LE"
    
    Source
    {"productSku":"BWWMSFSS-LE"}
    
    Handler for Request not found: 
    
    Request.HttpMethod: GET
    Request.HttpMethod: GET
    Request.PathInfo: /ucommerceapi/Json/SyncReply/GetProductVariations
    Request.QueryString: 
    Request.RawUrl: /ucommerceapi/Json/SyncReply/GetProductVariations

    I followed the suggestions described here and in the setup readme of the razor store.

    I had to manually add the 'ServiceStackApi' entry to the core.config, but my web.config and urlrewriting.config files matched what was described.

    The error still appears each time i load the product page, or change the selection in the 'collar size' list.

    I see mention of copying a global.asax file, but i don't see that file in the store source project i brought down, or in the website after having installed the store package.  Is that a key piece, and if so where do i find that file?

  • Søren Spelling Lund 1797 posts 2786 karma points
    Nov 27, 2012 @ 23:15
    Søren Spelling Lund
    0

    It really should happen automatically with the latest version of the store. When did you download the version you're testing out?

  • henk 2 posts 22 karma points
    Nov 28, 2012 @ 11:31
    henk
    0

    I've downloaded it on nov 19. 

    @e: I will try that! 

  • e 23 posts 42 karma points
    Nov 28, 2012 @ 15:05
    e
    0

    I believe i was using a package I downloaded on 11/20/12, but i also had a version of the project i had downloaded on 11/14/12 and built.  I'm not certain which version i actually used...

  • e 23 posts 42 karma points
    Nov 28, 2012 @ 22:05
    e
    0

    Just an update:

    I grabbed the latest version of uCommerce and the razor store as of today (11/28/12) and ran through the installation process on a new umbraco site.

    After completing the main install/setup steps, I hit the root of the store, browsed to a product, and attempted to change the product options.  I received the same error as i had last time:

    "NetworkError: 404 Not Found - http://localhost:90/ucommerceapi/Json/SyncReply/GetProductVariations"

    Steps I have taken to resolve:

    * I had to manually update /ucommerce/configuration/core.config to add the following node just before the closing </components> node:

    <component id="ServiceStackApi" service="uCommerce.RazorStore.ServiceStack.AppHost, uCommerce.RazorStore" type="uCommerce.RazorStore.ServiceStack.AppHost, uCommerce.RazorStore" lifestyle="Singleton"/> 

    * I then updated the AppHost.cs file in the UCommerce.RazorStore project, in the ServiceStack folder to add a line to the 'Configure' method (per here: http://our.umbraco.org/projects/website-utilities/ucommerce/ucommerce-support/35314-ServiceStack-REST-methods-404-on-uCommerce-30?p=0#comment132028)

             public override void Configure(Container container) 
    {
    SetConfig(new EndpointHostConfig { ServiceStackHandlerFactoryPath = "ucommerceapi" });
    }   

    After a rebuild/redeploy of UCommerce.RazorStore.dll, the website works as expected when calling the ServiceStack items.

     

     


  • Søren Spelling Lund 1797 posts 2786 karma points
    Dec 07, 2012 @ 20:23
    Søren Spelling Lund
    0

    Thanks for being awesome and posting the follow-up. I will do some testing on this end with regards to this.

Please Sign in or register to post replies

Write your reply to:

Draft