Click here to Skip to main content
15,890,897 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I am having WCF services with username pasword validator implemented with HTTPS and i am able to browse the WSDL from the browser and can see the methods.

But when i try to add Service Reference from Visual Studio i am getting below error.

There was an error downloading 'https://domain.com/RatingService.svc?wsdl/_vti_bin/ListData.svc/$metadata'.
The underlying connection was closed: An unexpected error occurred on a send.
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: '<a href="https://domain.com/">https://domain.com/</a>[<a href="https://domain.com/" target="_blank" title="New Window">^</a>]/RatingService.svc?wsdl'.
An error occurred while making the HTTP request to <a href="https://domain.com/">https://domain.com</a>[<a href="https://domain.com/" target="_blank" title="New Window">^</a>]/RatingService.svc?wsdl. This could be due to the fact that the server certificate is not configured properly with HTTP.SYS in the HTTPS case. This could also be caused by a mismatch of the security binding between the client and the server.
The underlying connection was closed: An unexpected error occurred on a send.
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
If the service is defined in the current solution, try building the solution and adding the service reference again.


What I have tried:

this is my web.config file

<?xml version="1.0"?>
<configuration>

  <appSettings>
    <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
  </appSettings>
  <system.web>
    <customErrors mode="Off"></customErrors>
    <compilation debug="true" targetFramework="4.5" />
    <httpRuntime targetFramework="4.5"/>
  </system.web>
  <system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior name="ServiceBehavior">
          <!-- To avoid disclosing metadata information, set the values below to false before deployment -->
          <serviceMetadata httpsGetEnabled="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="false"/>
          <serviceCredentials>
            <userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="IntegrationServices.ServiceAuthenticator, IntegrationServices"/>
          </serviceCredentials>
        </behavior>
      </serviceBehaviors>
    </behaviors>
<bindings>
  <wsHttpBinding>
    <binding name="BasicHttpBinding_ICommodityService" closeTimeout="00:10:00" openTimeout="00:10:00" sendTimeout="00:10:00" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647">
      <security mode="TransportWithMessageCredential">
        <message clientCredentialType="UserName"/>
      </security>
    </binding>
    <binding name="BasicHttpBinding_IRatingService" closeTimeout="00:10:00" openTimeout="00:10:00" sendTimeout="00:10:00" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647">
      <security mode="TransportWithMessageCredential">
        <message clientCredentialType="UserName"/>
      </security>
    </binding>
  </wsHttpBinding>
</bindings>
    <services>
      <service name="IntegrationServices.CommodityService" behaviorConfiguration="ServiceBehavior">
        <endpoint address="" binding="wsHttpBinding" bindingConfiguration="BasicHttpBinding_ICommodityService"  contract="IntegrationServices.ICommodityService"></endpoint>
        <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange"></endpoint>
      </service>
      <service name="IntegrationServices.RatingService" behaviorConfiguration="ServiceBehavior">
        <endpoint address="" binding="wsHttpBinding" bindingConfiguration="BasicHttpBinding_IRatingService" contract="IntegrationServices.IRatingService"></endpoint>
        <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange"></endpoint>
      </service>
    </services>
    
    <protocolMapping>
        <add binding="wsHttpBinding" scheme="https" />
    </protocolMapping>    
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="false" />
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
    <!--
        To browse web app root directory during debugging, set the value below to true.
        Set to false before deployment to avoid disclosing web app folder information.
      -->
    <directoryBrowse enabled="true"/>
  </system.webServer>

</configuration>


can anyone help me how to fix the issue.
Posted
Updated 28-Jan-19 4:26am
v2

1 solution

Look at the server response for the URL from your question:
https://integrations.trxglobal.com/RatingService.svc?wsdl:
Configuration binding extension 'system.serviceModel/bindings/wsHttpsBinding' could not be found. Verify that this binding extension is properly registered in system.serviceModel/extensions/bindingExtensions and that it is spelled correctly.

You have a configuration error on your server which you will need to fix.

(You also need to turn on custom errors to avoid exposing such detailed information to the whole world.)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900