【问题标题】:basicHttpBinding security mode not successfully inferred by wcf test clientwcf 测试客户端未成功推断 basicHttpBinding 安全模式
【发布时间】:2011-07-29 14:37:45
【问题描述】:

我有一个用 VB.NET 编写的 WCF 服务,它表现出奇怪的行为。 web.config 有以下 xml:

<system.serviceModel>
  <services>
    <service behaviorConfiguration="CentricBasicHttpBehavior" name="OnbaseService">
      <endpoint binding="basicHttpBinding" bindingConfiguration="CentRicBasicHttpServerBinding" contract="IOnbaseService">
        <identity>
          <servicePrincipalName value="HTTP/JFOLKENDT7E" />
        </identity>
      </endpoint>
      <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
    </service>
  </services>
  <behaviors>
    <serviceBehaviors>
      <behavior name="CentricBasicHttpBehavior">
        <serviceAuthorization impersonateCallerForAllOperations="true" />
        <serviceMetadata httpGetEnabled="true" />
        <serviceDebug includeExceptionDetailInFaults="true" />
        <dataContractSerializer maxItemsInObjectGraph="2147483646" />
        <serviceThrottling maxConcurrentCalls="100" maxConcurrentSessions="100" maxConcurrentInstances="100" />
      </behavior>
      <behavior name="">
        <serviceMetadata httpGetEnabled="true" />
        <serviceDebug includeExceptionDetailInFaults="true" />
      </behavior>
    </serviceBehaviors>
  </behaviors>
  <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
  <bindings>
    <basicHttpBinding>
      <binding name="CentRicBasicHttpServerBinding" maxReceivedMessageSize="5000000">
        <security mode="TransportCredentialOnly">
          <transport clientCredentialType="Windows" />
        </security>
      </binding>
    </basicHttpBinding>
  </bindings>
</system.serviceModel>

当我在 wcf 测试客户端中配置服务时,绑定模式和 TransportClientCredentialType 都显示为“无”。我希望它们分别是“TransportCredentialOnly”和“Windows”。

有人可以与我分享 WCF 测试客户端如何推断绑定配置,以及我应该如何解决这个问题?最终结果是,在服务的源代码中,WindowsIdentity 并没有像我预期的那样模拟用户。

谢谢,

杰森

【问题讨论】:

    标签: wcf basichttpbinding wcftestclient


    【解决方案1】:

    我和 Jason 一起工作,我们一起研究了这个问题。服务配置需要名称和联系人属性来匹配完全限定的服务类名称和完全限定的联系人接口名称。否则,我们会为默认服务获得有趣的新 .Net 4.0 默认绑定。

    【讨论】:

    • 是的。如果您查看 Service 标记的 Name 属性,您会发现我没有使用命名空间完全限定它。
    【解决方案2】:

    根据我自己使用 WCF 的经验,我在配置文件中修改了会话超时和连接超时设置,但 WCF 测试客户端不遵守这些设置。似乎 WCF 测试客户端只占用了与 WCF 服务通信的默认值。因此,我使用我自己的自定义 WCF 测试客户端通过生成 app.config 和代理来测试我的 WCF 服务。 cs 通过 svcutil.exe 。

    【讨论】:

    • 嗯...实际上(至少在这种情况下),WCF 测试客户端正在正确推断它,因为如果我将 WCF 测试客户端中的绑定配置更改为我在网络中放置的配置.config,并使用 wcf 测试客户端启动其中一种 Web 方法,我收到以下错误:“远程 HTTP 服务器不满足相互身份验证要求。”所以我认为 WCF 测试客户端在这里没有错误;我只是想知道它是如何推断绑定配置的,以便我可以修复它。
    猜你喜欢
    • 1970-01-01
    • 2020-05-26
    • 2013-12-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-04-08
    • 1970-01-01
    相关资源
    最近更新 更多