UriTemplate with wildcard not matching file extension?

Last post 09-02-2009 1:51 PM by tvish. 4 replies.

Sort Posts:

  • UriTemplate with wildcard not matching file extension?

    06-05-2009, 2:45 PM
    • Member
      point Member
    • fwillerup
    • Member since 06-05-2009, 6:12 PM
    • Posts 1

    I am using WCF REST RC2.

    My service is defined like this:

       [WebGet(UriTemplate = "media/{*uri}")]
       [OperationContract]
       public Stream GetMedia(string uri)
       {
          ...
       }

    My problem is that this matches "media/foo" and "media/foo/bar" but not "media/foo/bar.png"

    As soon as I put an extension in the URL, it is not matched by the template and I get a "resource cannot be found" error.

    Any ideas?

  • Re: UriTemplate with wildcard not matching file extension?

    08-21-2009, 11:54 AM
    • Member
      6 point Member
    • BrianKwall
    • Member since 08-21-2009, 3:46 PM
    • Posts 3

     Did you ever get a resolution on this issue?

    I am having the same problem. I would like to include a file extension and once I do the webservice returns the same error you are describing here.

    Here is my code

    <OperationContract()> <WebGet(UriTemplate:=

    "vi/{filename}?id={id}")> Function GetSomeKmz(ByVal filename As String, ByVal id As String) As System.IO.Stream

    If I do not add a file extension it works fine:

    http://localhost/Service.svc/vi/myfile?id=123

    As soon as I add a file extension it does not work

    http://localhost/Service.svc/vi/myfile.kmz?id=123

     

    Any help would be appreciated.

    Thanks,

    Brian

  • Re: UriTemplate with wildcard not matching file extension?

    08-21-2009, 11:55 AM
    • Member
      6 point Member
    • BrianKwall
    • Member since 08-21-2009, 3:46 PM
    • Posts 3

     Did you ever get a resolution on this issue?

    I am having the same problem. I would like to include a file extension and once I do the webservice returns the same error you are describing here.

    Here is my code

    <OperationContract()> <WebGet(UriTemplate:=

    "vi/{filename}?id={id}")> Function GetSomeKmz(ByVal filename As String, ByVal id As String) As System.IO.Stream

    If I do not add a file extension it works fine:

     

    http://localhost/Service.svc/vi/myfile?id=123

    As soon as I add a file extension it does not work

    http://localhost/Service.svc/vi/myfile.kmz?id=123

     

    Any help would be appreciated.

    Thanks,

    Brian

  • Re: UriTemplate with wildcard not matching file extension?

    08-21-2009, 12:01 PM
    • Member
      6 point Member
    • BrianKwall
    • Member since 08-21-2009, 3:46 PM
    • Posts 3

     Sorry for the double post. It said it failed so I posted again.

    I don't see  a way to delete my own posts so I guess it has to stay :(

     

    Brian

  • Re: UriTemplate with wildcard not matching file extension?

    09-02-2009, 1:51 PM
    • Member
      60 point Member
    • tvish
    • Member since 11-26-2008, 4:39 PM
    • Posts 30

     There is a behavior difference between VS Web Development server and IIS when it comes to matching extensions. Did you see if this works in IIS?

Page 1 of 1 (5 items)