WCF SOAP服务为HTTPS端点返回404 Not Found
本文关键字:返回 Not Found 端点 HTTPS SOAP 服务 WCF | 更新日期: 2023-09-27 18:28:58
我在域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
在没有HTTPS
的测试机器上访问WCF服务端点http://mydomain/FileService.svc/receiveRequest
时,它可以工作。
终于破解了!我缺少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
这两个端点对我都有效。