这应该足够了。如果我去site/core.svc/dowork
我得到一个 400 错误。
.ajax 调用的结果相同。我哪里做错了?
我正在努力使这个网络可以访问。我将添加一些方法来处理基于浏览器事件的状态管理。
[ServiceContract]
public interface Icore
{
[OperationContract]
[WebGet(ResponseFormat = WebMessageFormat.Xml)]
string DoWork();
}
[System.Web.Script.Services.ScriptService]
public class core : Icore
{
public string DoWork()
{
return "hello";
}
}
<behaviors>
<endpointBehaviors>
<behavior name="RestBehavior">
<webHttp />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="MetadataBehavior">
<serviceMetadata httpsGetEnabled="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<!-- Note: the service name must match the configuration name for the service implementation. -->
<service name="Fusion.core" behaviorConfiguration="MetadataBehavior" >
<!-- Add the following endpoint. -->
<!-- Note: your service must have an http base address to add this endpoint. -->
<endpoint contract="Fusion.Icore" binding="wsHttpBinding" bindingConfiguration="HttpsBinding" address="" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<bindings>
<basicHttpBinding>
<binding name="secureBinding">
<security mode="Transport"/>
</binding>
</basicHttpBinding>
<wsHttpBinding>
<binding name="HttpsBinding">
<security mode="Transport">
<transport clientCredentialType="None"/>
</security>
</binding>
</wsHttpBinding>
</bindings>