这是我的单参数OperationContract
[OperationContract]
[WebInvoke(Method = "GET",
ResponseFormat = WebMessageFormat.Xml,
BodyStyle = WebMessageBodyStyle.Wrapped,
UriTemplate = "xml/{id}")]
XmlElement GetXmlData(string id);
工作正常。
然后我想再添加一个参数。 。 。
[OperationContract]
[WebInvoke(Method = "GET",
ResponseFormat = WebMessageFormat.Xml,
BodyStyle = WebMessageBodyStyle.Wrapped,
UriTemplate = "xml/{id}/{name}")]
XmlElement GetXmlData(string id, string name);
http://localhost/rest/xml/1/smith
返回“Endpoint Not Found”
我该如何解决这个问题?请帮忙。谢谢。
这是我的System.serviceModel
的web.config文件<system.serviceModel>
<services>
<service behaviorConfiguration="RESTFulWCFService.PersonServiceBehavior" name="RESTFulWCFService.PersonService">
<endpoint address="" binding="webHttpBinding" contract="RESTFulWCFService.IPersonService" behaviorConfiguration="web">
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="RESTFulWCFService.PersonServiceBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="web">
<webHttp />
</behavior>
</endpointBehaviors>
</behaviors>