1

我是 WCF .net 的新手,我正在使用 3.5 VB.Net,所以我必须创建一个带有身份验证的 Web 服务,我使用了消息和用户名安全性这是我的 web.config

<system.serviceModel>
<bindings>
<wsHttpBinding>
  <binding name="Binding1">
    <security mode="Message">
      <message clientCredentialType="UserName" />
    </security>
  </binding>        
 </wsHttpBinding>

<services>
  <service name="Service" behaviorConfiguration="Behavior1">
      <identity>
        <dns value="MyWebSite"/>
      </identity>
    </endpoint>
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
  </service>
</services>
<behaviors>
   <serviceBehaviors>
        <behavior name="Behavior1">
      <serviceMetadata httpGetEnabled="true"/>
      <serviceDebug includeExceptionDetailInFaults="false"/>
          <serviceCredentials>
            <serviceCertificate findValue="MyWebSite"
                      storeLocation="LocalMachine"
                      storeName="My"
                      x509FindType="FindBySubjectName" />
             <userNameAuthentication userNamePasswordValidationMode="Custom"
                 customUserNamePasswordValidatorType= "CustomUsernamePasswordAuth, App_Code" />
            </serviceCredentials>

        </behavior>             
    </serviceBehaviors>

</behaviors>

当我在客户端测试此服务时,我收到一条错误消息,告诉我“发生错误并且经过一些研究后无法验证消息安全性,我发现此问题是由于客户端和服务器(我的机器)之间的同步造成的但是两台机器完全同步,它们的日期时间完全相同,我迷路了:(

4

0 回答 0