[英]WCF REST URIs ending in %20 fail with 404
WCF REST Web服务以以下格式提供查找:
https://mysite/mycontract/search/{searchtext}
搜索文本hello或hello%20world ,并且服务正确执行。 但是,当使用https:// mysite / mycontract / search / hello%20中以空格结尾的文本时,服务将失败并显示404。没有自定义路由。
wcf路由中的哪些限制导致此问题,并且有哪些解决方法(除了更改uri结构之外,还可以使用)?
使用其他实现信息进行编辑:
合同
[ServiceContract(SessionMode = SessionMode.NotAllowed)]
public interface IPointOfSale
{
.......
[WebInvoke(UriTemplate = "search/{SKU}", Method = "GET")]
System.Xml.Linq.XElement ProductLookup(string SKU);
}
方法
public XElement ProductLookup(string SKU)
{
//product search here.
}
我今天一直在处理同一问题,并且发现其他帖子告诉您,在.NET 4中,解决方案在于在web.config中设置以下内容:
<httpRuntime relaxedUrlToFileSystemMapping="true" />
这为我解决了问题!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.