Castle Windsor WCF Facility未设置用户名凭据

时间:2013-01-09 11:33:50

标签: c# wcf castle-windsor

我无法理解为什么WCF Facility未能在我的客户端配置上设置用户名凭据。谁能看到我哪里错了?

从容器解析IService时,ClientCredentials.UserName.UserName和Password为null。和端点等效项一样。根本没有设置任何凭据引用,并且所有凭据引用都保留为空值。

container
   .Register(
        Component
            .For<IService>()
            .ImplementedBy<ServiceClient>()
                .AsWcfClient(
                     new DefaultClientModel
                          {
                              Endpoint = WcfEndpoint
                                  .FromConfiguration("binding"),
                          }
                 .Credentials(
                        new UserNameCredentials(
                            "username", 
                            "password"))));

正在从app.config文件中正确选取绑定和端点配置 - 这纯粹是我需要解析的身份验证。

完整性:

 <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="binding" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
          <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
          <security mode="TransportWithMessageCredential">
            <message clientCredentialType="UserName" algorithmSuite="Default" />
          </security>
        </binding>
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="http://___________________" binding="basicHttpBinding" bindingConfiguration="binding" contract="Namespace.Class" name="binding" />
    </client>
  </system.serviceModel>

0 个答案:

没有答案
相关问题