WCF REST webHttpBinding - 404错误

时间:2014-12-30 08:10:34

标签: c# wcf iis webhttpbinding webhttp

这项服务我可以在我们的IIS服务器托管时通过浏览器调用方法时看到JSON数据,但是在将它移动到客户端的服务器之后。虽然我只能通过WCF Test CLient查看,但我看不到来自浏览器的数据。 ..我哪里出错了......你能说明应该做些什么。

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

1 个答案:

答案 0 :(得分:0)

您需要在其中添加base address

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

然后是你的webHttpBinding端点的相对地址&#34; ws&#34;将决定

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