locked
The request fail with empty response RRS feed

  • Question

  • User-150770710 posted

    Hi

    I have created a WCF service, and configure it to use webHttp to support REST. However, I failed to use svcutil to retrieve its metadata.

    HTTP GET Error
        URI: http://xxx.xxx.xxx.xxx/SecretCodeParserWCFService/SecretCodeParserWCFSe
    rvice.SecretCodeParserWCFService.svc?wsdl
    
        There was an error downloading 'http://xxx.xxx.xxx.xxx/SecretCodeParserWCFSe
    rvice/SecretCodeParserWCFService.SecretCodeParserWCFService.svc?wsdl'.
    
        The request failed with an empty response.

    If I use browser to access it, chrome would return "This web page has a redirect loop".

    Below is my WCF service web.config

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
      <system.web>
        <compilation debug="true" />
      </system.web>
      <!-- When deploying the service library project, the content of the config file must be added to the host's 
      app.config file. System.Configuration does not support config files for libraries. -->
      <system.serviceModel>
        <services>
          <service behaviorConfiguration="SercetCodeParserWCFService.Service1Behavior"
            name="SercetCodeParserWCFService.SecretCodeParserWCFService">
            <endpoint address="" binding="webHttpBinding" contract="SercetCodeParserWCFService.ISecretCodeParserWCFService">
              <identity>
                <dns value="localhost" />
              </identity>
            </endpoint>
            <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
            <host>
              <baseAddresses>
                <add baseAddress="http://xxx.xxx.xxx.xxx/SecretCodeParserWCFService/SecretCodeParserWCFService.SecretCodeParserWCFService" />
              </baseAddresses>
            </host>
          </service>
        </services>
        <behaviors>
          <serviceBehaviors>
            <behavior name="SercetCodeParserWCFService.Service1Behavior">
              <!-- To avoid disclosing metadata information, 
              set the value below to false and remove the metadata endpoint above before deployment -->
              <serviceMetadata httpGetEnabled="True" externalMetadataLocation="http://xxx.xxx.xxx.xxx/SecretCodeParserWCFService/SecretCodeParserWCFService.SecretCodeParserWCFService.svc?wsdl"/>
              <!-- To receive exception details in faults for debugging purposes, 
              set the value below to true.  Set to false before deployment 
              to avoid disclosing exception information -->
              <serviceDebug includeExceptionDetailInFaults="False" />
            </behavior>
          </serviceBehaviors>
          <endpointBehaviors>
            <behavior name="web">
              <webHttp />
            </behavior>
          </endpointBehaviors>
        </behaviors>
      </system.serviceModel>
    </configuration>
    

    Please advice tq

    Sunday, February 16, 2014 7:45 AM

All replies

  • User-484054684 posted

    Are you able to browse the url manually, (i.e., without svcutil)?

    If not, could you try enabling to show the faults by turning this parameter to true in the config. <serviceDebug includeExceptionDetailInFaults="True" />. Hope this will give more detailed information.

    Sunday, February 16, 2014 7:55 AM
  • User-150770710 posted

    Hi

    I hit this error

    There was an error downloading 'http://xxx.xxx.xxx.xxx/SercetCodeParserWCFService/SercetCodeParserWCFService.Service1Behavior/mex'.
    The request failed with HTTP status 404: Not Found.
    Metadata contains a reference that cannot be resolved: 'http://xxx.xxx.xxx.xxx/SercetCodeParserWCFService/SercetCodeParserWCFService.Service1Behavior/mex'.
    There was no endpoint listening at http://xxx.xxx.xxx.xxx/SercetCodeParserWCFService/SercetCodeParserWCFService.Service1Behavior/mex that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.
    The remote server returned an error: (404) Not Found.
    If the service is defined in the current solution, try building the solution and adding the service reference again.

    Any advice?

    Thank you

    Sunday, March 16, 2014 2:55 AM