【问题标题】:wcf The provided URI scheme 'http' is invalid; expected 'https'wcf 提供的 URI 方案“http”无效;预期“https”
【发布时间】:2012-04-09 04:34:48
【问题描述】:

我想根据这个post创建fileTransfer

当我在本地测试它时效果很好

我使用没有 ssl 的 iis 在服务器上设置我的服务

这是我的服务器配置:

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

我一直在网上寻求有关此安全问题的帮助,但此错误似乎很奇怪

【问题讨论】:

    标签: wcf wcf-security


    【解决方案1】:

    您的客户端和服务器绑定配置不兼容。服务器未指定安全性,但客户端指定了 TransportWithMessageCredential。您可以将客户端配置中的安全模式设置为无。


    我强烈建议您也使用WCF configuration editor,这样可以避免许多常见错误,例如拼写错误、不匹配绑定等。

    【讨论】:

    • ok iv 也试过了,这就是我得到的错误:HTTP 请求被客户端身份验证方案“匿名”禁止,我如何在没有 ssl 的情况下做到这一点?我不会将 https 放在我的网站中,但我仍然希望能够使用 wcf 而不是 ftp 控制文件夹 iv 问here
    • 我需要与 roy.d 相同的答案,提供的答案不允许我使用 http 和 windows 身份验证。谢谢!
    猜你喜欢
    • 2010-12-14
    • 1970-01-01
    • 1970-01-01
    • 2012-12-31
    • 1970-01-01
    • 2011-01-27
    • 1970-01-01
    • 2015-11-19
    • 2012-02-19
    相关资源
    最近更新 更多