none
WCF Message logging Filter properties RRS feed

  • Question

  • I have the following excerpt settings defined on a excercise from the WCF 70-503 exam training kit:

     <system.diagnostics>

        <sources>

          <source name="System.ServiceModel.MessageLogging" 

                  switchValue="Information, ActivityTracing" >

            <listeners>

              <add name="log" type="System.Diagnostics.XmlWriterTraceListener" 

                   initializeData="c:\dumps_Trace\Trace.svclog" />

            </listeners>

          </source>

        </sources>

        <trace autoflush="true" />

      </system.diagnostics>

      <system.serviceModel>

        <diagnostics>

          <messageLogging

            logEntireMessage="true"

            logMalformedMessages="false"

            logMessagesAtServiceLevel="true"

            logMessagesAtTransportLevel="true"

            maxMessagesToLog="3000" maxSizeOfMessageToLog="2000">

            <filters>

    <!--the required attribute filter is missing-->

              <add xmlns:soap="http://www.w3.org/2003/05/soap-envelope"

                   xmlns:a="http://www.w3.org/2005/08/addressing">

    <!--the element can not contain text. Content model is empty-->

                /soap:Envelope/soap:Header/a:Action[

                starts-with(text(),'http://schemas.xmlsoal.org')]

              </add>

            </filters>

          </messageLogging>

        </diagnostics>


    I get the following validation errors:

    - the required attribute filter is missing.

    -the element can not contain text. Content model is empty.

    Additionally Im searching for some details on the Filter properties of the Listener:

    -FilterInitData

    -FilterTypeName

    Detailed feedback would be greatly appreciated.

    Thanks


    dblk

    Tuesday, June 25, 2013 3:24 PM

Answers

  •         <filters>

    <!--the required attribute filter is missing-->

              <add xmlns:soap="http://www.w3.org/2003/05/soap-envelope"

                   xmlns:a="http://www.w3.org/2005/08/addressing">

    <!--the element can not contain text. Content model is empty-->

                /soap:Envelope/soap:Header/a:Action[

                starts-with(text(),'http://schemas.xmlsoal.org')]

              </add>

            </filters>

          </messageLogging>

        </diagnostics>

    Hi,

    If custom actions are not used, the Action included in each message takes the following format.
    ContractNamespace/ContractName/OperationName
    Here is a example:

    <filters>
       <add xmlns:soap="http://www.w3.org/2003/05/soap-envelope" 
    xmlns:a="http://www.w3.org/2005/08/addressing">
    /soap:Envelope/soap:Header/a:Action[starts-with(text(),'http://Microsoft.ServiceModel.Samples/ICalculator/Add')]</add>
    
    </filters>

    If custom actions are used, message logging can be used to filter messages using the following action.

    <add xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing">/soap:Envelope/soap:Header/a:Action/text()="MyAction"</add>

    For more information, please try to refer to:

    #Using Filters for Message Logging:
    http://msdn.microsoft.com/en-us/library/vstudio/aa967569(v=vs.90).aspx .

    Hope it can help you.

    Best Regards.




    Amy Peng
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.


    Wednesday, June 26, 2013 10:01 AM
    Moderator

All replies

  •         <filters>

    <!--the required attribute filter is missing-->

              <add xmlns:soap="http://www.w3.org/2003/05/soap-envelope"

                   xmlns:a="http://www.w3.org/2005/08/addressing">

    <!--the element can not contain text. Content model is empty-->

                /soap:Envelope/soap:Header/a:Action[

                starts-with(text(),'http://schemas.xmlsoal.org')]

              </add>

            </filters>

          </messageLogging>

        </diagnostics>

    Hi,

    If custom actions are not used, the Action included in each message takes the following format.
    ContractNamespace/ContractName/OperationName
    Here is a example:

    <filters>
       <add xmlns:soap="http://www.w3.org/2003/05/soap-envelope" 
    xmlns:a="http://www.w3.org/2005/08/addressing">
    /soap:Envelope/soap:Header/a:Action[starts-with(text(),'http://Microsoft.ServiceModel.Samples/ICalculator/Add')]</add>
    
    </filters>

    If custom actions are used, message logging can be used to filter messages using the following action.

    <add xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing">/soap:Envelope/soap:Header/a:Action/text()="MyAction"</add>

    For more information, please try to refer to:

    #Using Filters for Message Logging:
    http://msdn.microsoft.com/en-us/library/vstudio/aa967569(v=vs.90).aspx .

    Hope it can help you.

    Best Regards.




    Amy Peng
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.


    Wednesday, June 26, 2013 10:01 AM
    Moderator
  • Hi, I am having the same problem that was originally posted. The answer does not solve the problem. In the answer, the 'add' does not include the mandatory 'filter' attribute, so the config file remains flagged for a warning. The link here for 'filter - add' shows how you must provide the 'filter' attribute to the 'add'.

    That link shows the following invalid example as it also does not use the mandatory 'filter' attribute:

         <filters>
            <add xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
                            /soap:Envelope/soap:Headers
            </add>
         </filters>

    Also this example provides a 'value' of "/soap:Envelope/soap:Headers", but that is also flagged in VS saying "The element cannot contain text. Content model is empty". This was also posted as the original problem which remains a problem. Can someone provide an example that compiles without these 2 warnings? Again, the 2 warnings are:

    1. The required attribute 'filter' is missing (from the 'add')

    2. The element cannot contain text. Content model is empty.


    philb222

    Monday, July 11, 2016 6:28 PM