1

A WCF REST web service provides a lookup in the format:

https://mysite/mycontract/search/{searchtext}

A search text of hello, or hello%20world, and the service performs correctly. However, when using text ending in whitespace as in https://mysite/mycontract/search/hello%20 the service will fail with a 404. There is no custom routing.

What limitations in wcf routing causes this, and what workarounds (ideally besides changing the uri structure) are available?

Edit w/ additional implementation info:

contract

    [ServiceContract(SessionMode = SessionMode.NotAllowed)]
    public interface IPointOfSale
    {
        .......

        [WebInvoke(UriTemplate = "search/{SKU}", Method = "GET")]
        System.Xml.Linq.XElement ProductLookup(string SKU);

    }

method

public XElement ProductLookup(string SKU)
{
   //product search here.
}
James A Mohler
  • 11,060
  • 15
  • 46
  • 72
seraphym
  • 1,126
  • 1
  • 8
  • 21

1 Answers1

1

I have been working with the same issue today, and found other posts telling that, in .NET 4, the solution lies in setting the following in web.config:

<httpRuntime relaxedUrlToFileSystemMapping="true" />

This solved the problem for me!

Barslett
  • 286
  • 1
  • 2
  • 5