想在我的REST JSON WCF服务上启用https并在IE浏览器中对其进行测试。 WSDL正在加载,没有任何问题(https://localhost/myservice/Imyservice.svc?WSDL)。 但是我试图调用一个操作(https://localhost/myservice/Imyservice.svc/Getdata), 请求错误服务器在处理请求时遇到错误。。 以下是我的web.config。谁能帮助我
<webHttpBinding>
<binding name="SecureBasicRest" allowCookies="true" >
<security mode="Transport" />
<readerQuotas maxDepth="32"/>
</binding>
</webHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="svcBehavior">
<serviceMetadata httpsGetEnabled="true" httpGetEnabled="false"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="svcEndpoint">
<webHttp helpEnabled="true"/>
</behavior>
</endpointBehaviors>
</behaviors>
<services>
<service name="myservice.Imyservice" behaviorConfiguration="svcBehavior">
<endpoint binding="webHttpBinding" bindingConfiguration="SecureBasicRest"
behaviorConfiguration="svcEndpoint" name="webHttp"
contract="myservice.Imyservice" />
</service>
</services>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
答案 0 :(得分:0)
根本原因是服务端点的定义有问题。
<service name="myservice.Imyservice" behaviorConfiguration="svcBehavior">
<endpoint binding="webHttpBinding" bindingConfiguration="SecureBasicRest"
behaviorConfiguration="svcEndpoint" name="webHttp"
contract="myservice.Imyservice" />
</service>
您的想法是正确的,我们应该添加具有传输安全性模式的服务端点。但是,服务名称应该是服务实现类的标准名称,而不是服务接口。
<service name="myservice.myservice"
请随时让我知道问题是否仍然存在。