0
votes

Hi I have deployed the WCF web service on the server machine. I am able to browse it in browser. but when i am going to add its service reference to my web application on development machine I am getting following detail error:

Metadata contains a reference that cannot be resolved: 'http://ServerMachineName:500/ITCAMSWebService_deploy/Services/Authentication.svc?wsdl'. The WSDL document contains links that could not be resolved. There was an error downloading 'http://ServerMachineName:500/ITCAMSWebService_deploy/Services/Authentication.svc?xsd=xsd0'. The underlying connection was closed: An unexpected error occurred on a receive. Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. An existing connection was forcibly closed by the remote host Metadata contains a reference that cannot be resolved: 'http://ServerMachineName:500/ITCAMSWebService_deploy/Services/Authentication.svc'. Content Type application/soap+xml; charset=utf-8 was not supported by service http://ServerMachineName:500/ITCAMSWebService_deploy/Services/Authentication.svc. The client and service bindings may be mismatched. The remote server returned an error: (415) Cannot process the message because the content type 'application/soap+xml; charset=utf-8' was not the expected type 'text/xml; charset=utf-8'.. If the service is defined in the current solution, try building the solution and adding the service reference again.

Generated Service Model section in Web.config at server is as follows:

<system.serviceModel>
      <services>
          <service name="Authentication" behaviorConfiguration="Behavior_Authentication">
              <host>
                  <baseAddresses>
                      <add baseAddress="http://ServerMachineName:500/ITCAMSWebService_deploy/Services/Authentication.svc"></add>
                  </baseAddresses>
              </host>
              <endpoint address="" contract="IAuthentication" binding="basicHttpBinding" bindingConfiguration="ITCAMSWebService.IAuthentication" />

          </service>
      </services>
    <behaviors>


      <serviceBehaviors>
        <behavior>
          <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
          <serviceMetadata httpGetEnabled="true" />
          <!-- 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="true" />
            <dataContractSerializer maxItemsInObjectGraph="2147483646" />
        </behavior>
      </serviceBehaviors>


    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="true" />
  </system.serviceModel>
2
If you have access to the server, enable tracing in the config of the wcf service. It will tell you exactly what went wrong. - Preben Huybrechts

2 Answers

1
votes

Resolved !!! By adding Everyone user with full rights to C:\Windows\Temp on the server. IIS needs the rights to generate Metadata file in Temp folder on the server.

0
votes

Please give ip address of your server in the address instead of ServerMachineName and also check the bindings of both client n server