首页 新闻 会员 周边

web service windows身份认证

0
悬赏园豆:30 [已关闭问题] 关闭于 2012-06-25 11:07

  当前的project中有web service的引用,其配置如下:

<system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="ReceiveInterfaceAppUpdatesSoap" ...
                 useDefaultWebProxy="true">
         
     <security mode="TransportCredentialOnly">
            <transport clientCredentialType="Basic" proxyCredentialType="Windows" realm="" />
            <message clientCredentialType="UserName" algorithmSuite="Default" />
          </security>
        </binding>
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="..."
                binding="basicHttpBinding" bindingConfiguration="ReceiveInterfaceAppUpdatesSoap"
                contract="..." name="..." />
    </client>
  </system.serviceModel>

client的调用如下:

....
// 服务代理
ServiceClient proxy=new ServiceClient(); // 设置账户和密码
proxy.ClientCredentials.Windows.ClientCredentials.UserName
="..."; proxy.ClientCredentials.Windows.ClientCredentials.Password="..."; //invoke

当调用的服务时,总是出现异常。经过测试发现,<transport>节点的不同配置将导致不同的异常。现在知道webservice授权的账户和密码,但始终不能正常调用。
  我猜测服务端使用的是windows授权机制,但是不知道在client端的config文件如何配置,尤其是<transport>节点的配置?请园友指点!

华-子的主页 华-子 | 初学一级 | 园豆:156
提问于:2012-06-19 17:08
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册