Gangadhar Nagaraju Ответов: 1

Возникли проблемы с добавлением ссылки на службу с https из visual studio


Привет,

У меня есть службы WCF с валидатором username pasword, реализованным с помощью HTTPS, и я могу просматривать WSDL из браузера и видеть методы.

Но когда я пытаюсь добавить ссылку на службу из Visual Studio, я получаю следующую ошибку.

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.


Что я уже пробовал:

это мой файл web.config

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


может ли кто-нибудь помочь мне, как исправить эту проблему.

1 Ответов

Рейтинг:
1

Richard Deeming

Посмотрите на ответ сервера для URL-адреса из вашего вопроса:

https://integrations.trxglobal.com/RatingService.svc?wsdl:
Расширение привязки конфигурации 'system.serviceModel/bindings/wsHttpsBinding' найти его не удалось. Убедитесь, что это расширение привязки правильно зарегистрировано в system.serviceModel/extensions/bindingExtensions и что оно пишется правильно.

У вас есть ошибка конфигурации на вашем сервере, которую вам нужно будет исправить.

(Вам также нужно включить пользовательские ошибки, чтобы избежать раскрытия такой подробной информации всему миру.)