【发布时间】:2014-06-06 16:25:20
【问题描述】:
我有一个web服务界面看起来像
[ServiceContract]
public interface IASchoolsWebService
{
[OperationContract]
[WebGet(ResponseFormat = WebMessageFormat.Json, UriTemplate = "Categories?shortString={shortString}")]
IEnumerable<string> GetCategoriesByShortString(string shortString);
}
实现看起来像
[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall, ConcurrencyMode = ConcurrencyMode.Single)]
public class ASchoolsWebService: IASchoolsWebService
{
public IEnumerable<string> GetCategoriesByShortString(string shortString)
{
// my Implementation here
}
}
网络服务使用网络参考工作正常,但我想用作 RESTFULL 服务以进一步 mobuke 应用程序任何想法如果我使用浏览器调用我得到 4oo
mywebservice.svc/Categories
我使用 web.conig 喜欢:
<behaviors>
<serviceBehaviors>
<behavior name="SchoolsWebServiceBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
</behavior>
<behavior name="SchoolsWebServiceSecureBehavior">
<serviceMetadata httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
</behavior>
<behavior name="">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service name="ArabicEWorld.WebService.ArabicEWorldWebService" behaviorConfiguration="SchoolsWebServiceBehavior">
<endpoint name="UnsecureEndpoint" binding="basicHttpBinding" bindingConfiguration="basicHttpBindingConfig" contract="ArabicEWorld.WebService.IArabicEWorldWebService" />
<!--<endpoint name="SecureEndpoint"
binding="basicHttpBinding"
bindingConfiguration="secureBasicHttpBindingConfig"
contract="MedStreaming.Schools.Server.WebService.IMedStreamingSchoolsWebService"/>-->
</service>
</services>
【问题讨论】: