WCF REST webHttpBinding - 404 Error

本文关键字:Error webHttpBinding REST WCF | 更新日期: 2023-09-27 18:35:42

这项服务我可以在托管在我们的IIS服务器上时通过浏览器调用方法时看到JSON数据,但在将其移动到客户端服务器之后。我看不到浏览器中的数据,尽管我只能通过 WCF 测试语言查看...我哪里出错了..你能建议应该做什么吗?

 <bindings>
        <wsHttpBinding>
            <binding name="LargeSettings" maxBufferPoolSize="524288"    maxReceivedMessageSize="6553600">
                <readerQuotas maxDepth="32" maxStringContentLength="100000" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384"/>
                <security mode="None"/>
            </binding>
        </wsHttpBinding>
    </bindings>
    <behaviors>
        <serviceBehaviors>
            <behavior name="mobserviceBehavior">
                <serviceMetadata httpGetEnabled="true"/>
                <serviceDebug includeExceptionDetailInFaults="true"/>
            </behavior>
        </serviceBehaviors>
        <endpointBehaviors>
            <behavior name="WebBehavior">
                <webHttp/>
            </behavior>
        </endpointBehaviors>
    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true"/>
    <services>
        <service name="clubconnect.mobservice" behaviorConfiguration="mobserviceBehavior">
            <endpoint address="" binding="wsHttpBinding" contract="clubconnect.imobservice" bindingConfiguration="LargeSettings"/>
            <endpoint address="ws" binding="webHttpBinding" contract="clubconnect.imobservice" behaviorConfiguration="WebBehavior">
                <identity>
                    <dns value="http://domain"/>
                </identity>
            </endpoint>
            <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
        </service>
    </services>

WCF REST webHttpBinding - 404 Error

您需要在其中添加一个基址:

        <host>
          <baseAddresses>
            <add baseAddress="http://<URL to the .svc file>" />
          </baseAddresses>
        </host>

然后,您的 webHttpBinding 端点"ws"的相对地址将解析为

http://<URL to the .svc file>/ws