我在域https://mydomain
上的IIS 8.5中托管了.NET 4.5 WCF服务,并在IIS中配置了https绑定和自签名证书。
我可以在https://mydomain/FileService.svc
当我尝试使用SoapUI将POST
某些数据发送到服务端点https://mydomain/FileService.svc/receiveRequest
时,我会回来HTTP/1.1 404 Not Found
我的web.config服务配置如下所示:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<!-- maxReceivedMessageSize = 1073741824 = 1 GB -->
<binding maxReceivedMessageSize="1073741824" maxBufferSize="1073741824" maxBufferPoolSize="1073741824" >
<security mode="None"></security>
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<protocolMapping>
<add binding="basicHttpBinding" scheme="http" />
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
<services>
<service name="Foo.FileService">
<endpoint contract="IFileService" binding="basicHttpBinding"></endpoint>
</service>
</services>
</system.serviceModel>
知道如何解决这个问题或获取更多信息以便进一步调试? 感谢。
编辑1
我已在 dev 计算机上测试了该服务。它部署在http://localhost
上,SoapUI的调用工作正常。我使用http://localhost/FileService.svc/receiveRequest
来调用服务端点,它使用200
和SOAP消息进行响应。
编辑2
在没有http://mydomain/FileService.svc/receiveRequest
的测试计算机上访问WCF服务端点HTTPS
时,它可以正常工作。
答案 0 :(得分:3)
终于破解了!我错过了HTTPS
端点的绑定,其中security
模式无法设置为None
。
这是绑定的更新配置:
<basicHttpBinding>
<binding name="myHttpsBinding" maxReceivedMessageSize="1073741824" maxBufferSize="1073741824" maxBufferPoolSize="1073741824">
<security mode="Transport">
<transport clientCredentialType="None"/>
</security>
</binding>
<binding name="myHttpBinding" maxReceivedMessageSize="1073741824" maxBufferSize="1073741824" maxBufferPoolSize="1073741824">
<security mode="None" />
</binding>
</basicHttpBinding>
这是服务端点的更新配置:
<service name="Foo.FileService">
<!-- HTTPS Endpoint -->
<endpoint contract="IFileService" binding="basicHttpBinding" bindingConfiguration="myHttpsBinding" ></endpoint>
<!-- HTTP Endpoint -->
<endpoint contract="IFileService" binding="basicHttpBinding" bindingConfiguration="myHttpBinding" ></endpoint>
</service>
现在两个端点http://mydomain/FileService.svc/receiveRequest
和https://mydomain/FileService.svc/receiveRequest
都适用于我。