首页 新闻 搜索 专区 学院

WCF Kerveros wsHttpBinding

0
悬赏园豆:5 [待解决问题]

服务的宿主是iis,我建立了一个客户端用service reference去获得代理类。

我阅读了msdn的一些文章,

http://msdn.microsoft.com/en-us/library/ff650619.aspx

negotiateServiceCredentials 设置为false。

在基于windows验证时, 调用的是kerberos。后来按照文章描述,去做报错了。以下是错误信息:System.ServiceModel.Security.SecurityNegotiationException: Secure channel cannot be opened because security negotiation with the remote endpoint has failed. This may be due to absent or incorrectly specified EndpointIdentity in the EndpointAddress used to create the channel. Please verify the EndpointIdentity specified or implied by the EndpointAddress correctly identifies the remote endpoint.  ---> System.ServiceModel.FaultException: The message could not be processed.

 

这个是我的web.config代码:

<system.serviceModel>
  <services>
    <service name="WCFService.Service1">
    <endpoint address="" binding="wsHttpBinding"
    contract="WCFService.IService1" />
  <endpoint address="mex" binding="mexHttpBinding"                                                             contract="IMetadataExchange" />
  <host>
    <baseAddresses>
      <add baseAddress="http://localhost:53696/Service1.svc" />
    </baseAddresses>
  </host>
  </service>
</services>

<behaviors>
  <serviceBehaviors>
    <behavior>
      <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>

      <serviceDebug includeExceptionDetailInFaults="false"/>
    </behavior>
</serviceBehaviors>
</behaviors>

<bindings>
  <wsHttpBinding>
    <binding>
      <security mode="Message">
      <message clientCredentialType="Windows" negotiateServiceCredential="false"/> 
      </security>
    </binding>
  </wsHttpBinding>
</bindings>

<protocolMapping>
  <add binding="basicHttpsBinding" scheme="https" />
  </protocolMapping>
  <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>

------------------------------------------------

这个是client的app.config

<system.serviceModel>
  <bindings>
    <wsHttpBinding>
      <binding name="WSHttpBinding_IService1" >
        <security mode="Message">
          <message clientCredentialType="Windows"/>
        </security>
      </binding>
    </wsHttpBinding>
  </bindings>
<client>
<endpoint address="http://localhost:53696/Service1.svc" binding="wsHttpBinding"
bindingConfiguration="WSHttpBinding_IService1" contract="SRTest.IService1"
name="WSHttpBinding_IService1">
    <identity>
      <!--其中域为PRO,Sandy是我的账户名,这个配置不太清楚对不对-->
      <servicePrincipalName value="PRO/Sandy"/>
    </identity>
  </endpoint>
 </client>
</system.serviceModel>

 

在亚马逊买了蒋老师的书,可是周一才能到,看到网上的电子版,讲解了工作组的例子。可惜没有关于域的例子。

WCF
烈日的主页 烈日 | 初学一级 | 园豆:197
提问于:2013-11-15 15:19
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册