gpt4 book ai didi

c# - WCF SOAP 服务为 HTTPS 终结点返回 404 Not Found

转载 作者:行者123 更新时间:2023-11-30 21:52:41 25 4
gpt4 key购买 nike

我在域 https://mydomain 上的 IIS 8.5 中托管了 .NET 4.5 WCF 服务,并在 IIS 中配置了 https 绑定(bind)和自签名证书。

我可以在浏览器中访问我的服务的配置页面 https://mydomain/FileService.svc

当我尝试使用 SoapUI 将一些数据POST到端点https://mydomain/FileService.svc/receiveRequest时,我返回 HTTP/1.1 404 未找到

我的 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

我已经在我的开发机器上测试了该服务。它部署在 http://localhost 上,并且来自 SoapUI 的调用有效。我使用 http://localhost/FileService.svc/receiveRequest 调用服务端点,它以 200 和 SOAP 消息进行响应。

编辑2

在我的测试计算机上访问 WCF 服务端点http://mydomain/FileService.svc/receiveRequest(没有HTTPS)时,它可以工作。

最佳答案

终于破解了!我缺少 HTTPS 端点的绑定(bind),其中 security 模式无法设置为 None

这是绑定(bind)的更新配置:

<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/receiveRequesthttps://mydomain/FileService.svc/receiveRequest 都为我工作。

关于c# - WCF SOAP 服务为 HTTPS 终结点返回 404 Not Found,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34609836/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com