locked
HttpWeb Services and Routing in WCF 4 RRS feed

  • Question

  • In WCF 4 there is support for routing in HttpWeb Services...however unlike routing in ASP.Net variables are not supported, instead variable support is offered only through the UriTemplate parameter.

    However, the following is a URL I would like to support (legacy protocols) and as you can see there is a variable in the base of the address:

    http://me.com/{databaseName}/resource/{id}

    Can I solve this through routing or can I only solve this through Uri templating, e.g. for a Task resource I would need to specify:

    [WebGet(UriTemplate = "{databaseName}/Tasks/{id}")]

    Ideally I would like a base service endpoint with a global variable in the address (specified in Global.ascx): http://me.com/{databaseName}

    a route address (specified in Global.ascx) per resource, e.g. RouteTable.Routes.Add(new ServiceRoute("Tasks", factory, typeof(TaskService)));

    and a UriTemplate per resource (specified in the resource's service), e.g.  [WebGet(UriTemplate = "{id}")]

    Can anyone help?

    Thanks

    • Edited by Architectural Cat Wednesday, March 31, 2010 9:59 AM changed text
    • Moved by Mog Liang Friday, April 2, 2010 2:31 AM From: Windows Communication Foundation (From:Windows Communication Foundation)
    Wednesday, March 31, 2010 9:57 AM

Answers

All replies