2016-09-16 5 views
0

У меня есть приложение службы WCF, которое будет развернуто через IIS.C# WCF Service Application Base Address Issue

URL-адрес службы для службы: http://localhost:42543/Loyalty.svc, однако при публикации на веб-сервере URL-адрес будет http://ServerName:1066/Loyalty.svc.

Однако, когда я перейти к URL я получаю следующее сообщение об ошибке:

Could not find a base address that matches scheme https for the endpoint with binding WSHttpBinding. Registered base address schemes are [http].

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: Could not find a base address that matches scheme https for the endpoint with binding WSHttpBinding. Registered base address schemes are [http].

web.config, для сайта здесь:

<system.serviceModel> 
    <bindings> 
     <wsHttpBinding> 
     <binding name="wsSecureBinding"> 
      <security mode="TransportWithMessageCredential"> 
      <message clientCredentialType="UserName"/> 
      <transport clientCredentialType="None" proxyCredentialType="None" /> 
      </security> 
     </binding> 
     </wsHttpBinding> 
    </bindings> 
    <services> 
     <service behaviorConfiguration="default" name="IISService.Loyalty"> 
     <endpoint address="" binding="wsHttpBinding" bindingConfiguration="wsSecureBinding" name="secureService" contract="IISService.ILoyalty"/>  
     </service> 
    </services> 
    <behaviors> 
     <serviceBehaviors> 
     <behavior name="default"> 
      <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/> 
      <serviceDebug includeExceptionDetailInFaults="true"/> 
      <serviceCredentials> 
      <userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="IISService.SecurityValidation, IISService"/> 
      </serviceCredentials> 
     </behavior> 
     </serviceBehaviors> 
    </behaviors> 
    <protocolMapping> 
     <add binding="basicHttpsBinding" scheme="https" /> 
    </protocolMapping> 
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" /> 
    </system.serviceModel> 

Я также использую основную транспортную secuirty модель, как указано здесь http://www.c-sharpcorner.com/UploadFile/manas1/implementing-username-password-security-in-wcf-service/.

Заранее за вашу помощь.

+0

Просто дикое предположение: вы еще не настроили https для вашего сайта, на котором размещен ваш сервис в IIS, верно? – khlr

ответ

0

Похоже, что у вас нет соответствующих серверов, настроенных для HTTPS.

IIS должен иметь привязку к порту с настроенной HTTPS. см. https://msdn.microsoft.com/en-us/library/hh556232%28v=vs.110%29.aspx?f=255&MSPPError=-2147217396

Cassini не поддерживает SSL и не будет работать. IIS Express необходимо будет включить SSL в Visual Studio. См. http://www.codeproject.com/Tips/723357/Enabling-SSL-with-IIS-Express-in-Visual-Studio