locked
At least one security token in the message could not be validated RRS feed

  • Question

  • User-1141190189 posted

    i am trying to test a WCF web service using a test application. i have  a validate function in my code for service credentials and i am passing the user name and password from the 

    test application but the following exception always appears.

    At least one security token in the message could not be validated

    below is web.config file for the web service

    <?xml version="1.0"?>
    <configuration>
      <appSettings/>
      <connectionStrings>
    
    
        <add connectionString="Data Source=testDB;User Id=test;Password=test" name="ConnectionString" providerName="Oracle.DataAccess.Client" />
      </connectionStrings>
      <system.web>
        <compilation debug="true" targetFramework="4.0"/>
    
        <authentication mode="None"/>
    
        <membership defaultProvider="MITSqlMembershipProvider">
          <providers>
            <clear/>
            <add name="MySqlMembershipProvider" connectionStringName="MySQLServer" applicationName="My_WCFService" type="System.Web.Security.SqlMembershipProvider"/>
          </providers>
        </membership>
        <pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/>
      </system.web>
    
      <system.serviceModel>
        <bindings>
    
          <customBinding>
            <binding name="SafeServiceConf">
              <security authenticationMode="UserNameOverTransport" includeTimestamp="false">
              </security>
    
              <textMessageEncoding messageVersion="Soap11">
                <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
              </textMessageEncoding>
    
              <httpsTransport useDefaultWebProxy="true" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" />
    
    
            </binding>
          </customBinding>
        </bindings>
        <services>
          <service behaviorConfiguration="MyService.Service1Behavior" name="MyWCF.Services.MyService">
    
            <endpoint address="" binding="customBinding" bindingConfiguration="SafeServiceConf" contract="MyWCF.Services.IMyService" />
            <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
          </service>
        </services>
        <behaviors>
          <serviceBehaviors>
            <behavior name="WcfService.Service1Behavior">
    
              <useRequestHeadersForMetadataAddress/>
              <serviceMetadata httpsGetEnabled="true" httpGetEnabled="true" />
              <!--      -->
              <serviceDebug includeExceptionDetailInFaults="true" />
    
              <serviceAuthorization principalPermissionMode="UseAspNetRoles" roleProviderName="MySqlRoleProvider" />
    
              <serviceCredentials>
                <userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="MyWCF.CustomValidator,MyWCF.UserValidator" />
              </serviceCredentials>
    
    
            </behavior>
          </serviceBehaviors>
        </behaviors>
        <diagnostics>
          <messageLogging maxMessagesToLog="30000" logEntireMessage="true" logMessagesAtServiceLevel="false" logMalformedMessages="true" logMessagesAtTransportLevel="true">
            <filters>
              <clear/>
            </filters>
          </messageLogging>
        </diagnostics>
        <serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
      </system.serviceModel>
      <system.diagnostics>
        <sources>
          <source name="System.ServiceModel" switchValue="Warning, ActivityTracing" propagateActivity="true">
            <listeners>
              <add name="xml"/>
            </listeners>
          </source>
          <source name="System.ServiceModel.MessageLogging" switchValue="Warning">
            <listeners>
              <add name="xml"/>
            </listeners>
          </source>
        </sources>
        <sharedListeners>
          <add name="xml" type="System.Diagnostics.XmlWriterTraceListener" initializeData="C:\Temp\MyServer1.svclog"/>
        </sharedListeners>
        <trace autoflush="true" indentsize="4"/>
      </system.diagnostics>
    </configuration>

    Monday, January 30, 2017 12:37 PM

All replies