编辑 如果我尝试在没有 https 的情况下访问 /dowork 的 Web 服务端点,我仍然会收到错误,但它会识别有效的端点。如何启用 HTTPS?
我有一个 WCF 服务,最终将主要接收 AJAX 调用以根据用户行为管理状态。
目前我无法找回任何东西,你能看出我哪里出错了吗?(site/core.svc/dowork 在浏览器和 ajax 中都失败)
[ServiceContract]
public interface Icore
{
[OperationContract]
[WebInvoke(UriTemplate = "/dowork",
BodyStyle = WebMessageBodyStyle.Wrapped,
ResponseFormat = WebMessageFormat.Xml)]
string DoWork();
}
[System.Web.Script.Services.ScriptService]
public class core : Icore
{
public string DoWork()
{
return "hullo";
}
}
<system.web>
<compilation debug="true" targetFramework="4.5"/>
<customErrors mode="Off"/>
<pages controlRenderingCompatibilityVersion="4.0"/>
<webServices>
<protocols>
<add name="HttpGet"/>
<add name="HttpPost"/>
</protocols>
</webServices>
</system.web>
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
<bindings>
<webHttpBinding></webHttpBinding>
</bindings>
<services>
<service name="Fusion.core" behaviorConfiguration="Fusion.CoreBehavior" >
<endpoint contract="Fusion.Icore" binding="webHttpBinding" behaviorConfiguration="webBehavior" address="" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="Fusion.CoreBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="webBehavior">
<webHttp />
</behavior>
</endpointBehaviors>
</behaviors>
</system.serviceModel>