有人可以在web.config
中指出我的服务配置有什么问题。我想通过HTTPS
。
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="TransportSecurity">
<security mode="Transport">
<transport clientCredentialType="None"/>
</security>
</binding>
</wsHttpBinding>
</bindings>
<services>
<service name="WcfService1.Service1" behaviorConfiguration="WcfService1.Service1Behavior">
<endpoint binding="wsHttpBinding" bindingConfiguration="TransportSecurity" contract="WcfService1.IService1"/>
<endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="WcfService1.Service1Behavior">
<serviceMetadata httpGetEnabled="false" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="myBehavior">
<webHttp/>
<enableWebScript/>
</behavior>
</endpointBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="false">
</serviceHostingEnvironment>
</system.serviceModel>
我已使用SSL
上的测试证书启用IIS7
。可以访问Service1.svc
而没有任何错误,当通过200 OK Response
控制台客户端应用程序访问时,我得到.NET
。但我在访问服务中定义的400 Bad Request
时收到api
。与HTTP配置一起使用时,相同的api工作正常。