wcfwcf-security

wcf The provided URI scheme 'http' is invalid; expected 'https'


I'm trying to create fileTransfer base on this post

when i test it on local it works great

i set my service on the server using iis without ssl

this is my server config:

<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="false" multipleSiteBindingsEnabled="true"/>
<bindings>
  <wsHttpBinding>
    <binding name="TransferService" maxReceivedMessageSize="2147483647">
      <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
      <security mode="None" />
    </binding>
  </wsHttpBinding>
</bindings>

<services>
  <service behaviorConfiguration="TransferServiceBehavior" name="WcfFTP.FtpService">
    <endpoint address="FtpService.svc" binding="wsHttpBinding" bindingConfiguration="TransferService" contract="WcfFTP.IFileTransfer"/>
    <endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex"/>
  </service>
</services>
<behaviors>
  <serviceBehaviors>
    <behavior name="TransferServiceBehavior">
      <serviceMetadata httpGetEnabled="true"/>
      <dataContractSerializer maxItemsInObjectGraph="2147483647"/>
      <serviceDebug includeExceptionDetailInFaults="true"/>
      <serviceThrottling maxConcurrentCalls="500" maxConcurrentSessions="500" maxConcurrentInstances="500"/>
    </behavior>
  </serviceBehaviors>
</behaviors>

</system.serviceModel>

and that's my client:

 <system.serviceModel>
<bindings>
  <wsHttpBinding>
    <binding name="WSHttpBinding_IFileTransfer" closeTimeout="00:01:00"
      openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
      bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
      maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text"
      textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
      <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
        maxBytesPerRead="4096" maxNameTableCharCount="16384" />
      <reliableSession ordered="true" inactivityTimeout="00:10:00"
        enabled="false" />
      
      <security mode="TransportWithMessageCredential">
        <transport clientCredentialType="Digest" proxyCredentialType="None"
          realm="" />
        <message clientCredentialType="Windows" negotiateServiceCredential="true" />
      </security>
    </binding>
  </wsHttpBinding>
</bindings>
<client>
  <endpoint address="http://www.myhost.com/WsFTP/FtpService.svc"
    binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IFileTransfer"
    contract="FtpWcfClient.IFileTransfer" name="WSHttpBinding_IFileTransfer" />
</client>

</system.serviceModel>

iv been trying some help on the net with this security issue but this error seems to be strange


Solution

  • You binding configuration for client and server are incompatible. The server specifies no security but the client specifies TransportWithMessageCredential. Can you set security mode in client config to None.


    I strongly suggest you to use WCF configuration editor too, which save you against many common mistakes such as misspellings, mismatch binding etc.