cannot create Log with wshttpbinding

Topics: Exception Handling Application Block
Feb 15, 2012 at 3:54 PM

Hi, please help.

I don't know what's going wrong. 

below is the config. same config with basichttpbinding works in our local machine. but when deployed to server with wshttpbinding, it doesn't work. 

  <configSections>    <section name="loggingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="true" />    <section name="exceptionHandling" type="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Configuration.ExceptionHandlingSettings, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="true" />  </configSections>


  <loggingConfiguration name="" tracingEnabled="true" defaultCategory="General">    <listeners>      <add name="Event Log Listener" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.FormattedEventLogTraceListener, &#xD;&#xA;&#xD;&#xA;Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"        listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.FormattedEventLogTraceListenerData, &#xD;&#xA;&#xD;&#xA;Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"        source="Application Error" formatter="Text Formatter" log="Application"        machineName="." traceOutputOptions="DateTime, Timestamp" />      <add name="Flat File Trace Listener" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.FlatFileTraceListener, &#xD;&#xA;&#xD;&#xA;Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"        listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.FlatFileTraceListenerData, &#xD;&#xA;&#xD;&#xA;Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"        fileName="trace.log" />      <add name="Rolling Flat File Trace Listener" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.RollingFlatFileTraceListener, &#xD;&#xA;&#xD;&#xA;Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"        listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.RollingFlatFileTraceListenerData, &#xD;&#xA;&#xD;&#xA;Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"        fileName="C:\log\fusionservices.log" formatter="Text Formatter"        rollFileExistsBehavior="Increment" rollInterval="None" rollSizeKB="10"        timeStampPattern="yyyy-MM-dd" maxArchivedFiles="1" />    </listeners>    <formatters>      <add type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, &#xD;&#xA;&#xD;&#xA;Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"        template="Timestamp: {timestamp}{newline}&#xA;Message: {message}{newline}&#xA;Category: {category}{newline}&#xA;Priority: &#xD;&#xA;&#xD;&#xA;{priority}{newline}&#xA;EventId: {eventid}{newline}&#xA;Severity: {severity}{newline}&#xA;Title:{title}{newline}&#xA;Machine: &#xD;&#xA;&#xD;&#xA;{localMachine}{newline}&#xA;App Domain: {localAppDomain}{newline}&#xA;ProcessId: {localProcessId}{newline}&#xA;Process Name: &#xD;&#xA;&#xD;&#xA;{localProcessName}{newline}&#xA;Thread Name: {threadName}{newline}&#xA;Win32 ThreadId:{win32ThreadId}{newline}&#xA;Extended &#xD;&#xA;&#xD;&#xA;Properties: {dictionary({key} - {value}{newline})}"        name="Text Formatter" />    </formatters>    <categorySources>      <add switchValue="All" name="General">        <listeners>          <add name="Rolling Flat File Trace Listener" />        </listeners>      </add>    </categorySources>    <specialSources>      <allEvents switchValue="All" name="All Events">        <listeners>          <add name="Event Log Listener" />          <add name="Rolling Flat File Trace Listener" />        </listeners>      </allEvents>      <notProcessed switchValue="All" name="Unprocessed Category">        <listeners>          <add name="Rolling Flat File Trace Listener" />        </listeners>      </notProcessed>      <errors switchValue="All" name="Logging Errors &amp; Warnings">        <listeners>          <add name="Rolling Flat File Trace Listener" />        </listeners>      </errors>    </specialSources>  </loggingConfiguration>  
<exceptionHandling>    <exceptionPolicies>      <add name="WCF Exception Shielding">        <exceptionTypes>          <add name="All Exceptions" type="System.Exception, mscorlib, Version=4.0.0.0, Culture=neutral, &#xD;&#xA;&#xD;&#xA;PublicKeyToken=b77a5c561934e089"            postHandlingAction="ThrowNewException">            <exceptionHandlers>              <add type="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.WCF.FaultContractExceptionHandler, &#xD;&#xA;&#xD;&#xA;Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.WCF, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"                exceptionMessage="Fusion WCF Service message" faultContractType="AonHewitt.Cbt.Fusion.Common.Contracts.Service.ServiceFault, AonHewitt.Cbt.Fusion.Common.Contracts.Service"                name="Fault Contract Exception Handler">                <mappings>                  <add source="{Guid}" name="Id" />                  <add source="{Message}" name="MessageText" />                </mappings>              </add>              <add name="Fusion Logging Exception Handler" type="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging.LoggingExceptionHandler, &#xD;&#xA;&#xD;&#xA;Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging, Version=5.0.414.0, Culture=neutral, &#xD;&#xA;&#xD;&#xA;PublicKeyToken=31bf3856ad364e35"                logCategory="General" eventId="100" severity="Error" title="Enterprise Library Exception Handling"                formatterType="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.TextExceptionFormatter, &#xD;&#xA;&#xD;&#xA;Microsoft.Practices.EnterpriseLibrary.ExceptionHandling"                priority="0" />            </exceptionHandlers>          </add>        </exceptionTypes>      </add>    </exceptionPolicies>  </exceptionHandling>
<system.serviceModel>    <services>     
<service behaviorConfiguration="DefaultBehavior" name="AonHewitt.Cbt.Fusion.Services.Service.SiteService">        
<endpoint address="" binding="wsHttpBinding" bindingConfiguration="BasicHttpBinding_Text"           contract="Contracts.Service.ISiteService" />        
<endpoint address="basic" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_Text"              contract="Contracts.Service.ISiteService" />      </service>
</services>
    <bindings>      <basicHttpBinding>        <!-- added default behaviour of readerQuotas test -->        <binding>          <readerQuotas maxDepth="15" maxStringContentLength="524288" maxArrayLength="16384"          maxBytesPerRead="4096" maxNameTableCharCount="16384" />        </binding>        <binding name="BasicHttpBinding_Text" closeTimeout="00:10:00"            openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00"            allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"            maxBufferSize="2147483646" maxBufferPoolSize="2147483646" maxReceivedMessageSize="2147483646"            messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"            useDefaultWebProxy="true">          <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483646" maxArrayLength="2147483647"              maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />          <security mode="Transport">            <transport clientCredentialType="None" proxyCredentialType="None"                realm="" />            <message clientCredentialType="UserName" algorithmSuite="Default" />          </security>        </binding>        <binding name="BasicHttpBinding_Mtom" closeTimeout="00:10:00"            openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00"            allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"            maxBufferSize="2147483646" maxBufferPoolSize="2147483646" maxReceivedMessageSize="2147483646"            messageEncoding="Mtom" textEncoding="utf-8" transferMode="Streamed"            useDefaultWebProxy="true">          <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483646" maxArrayLength="2147483647"              maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />          <security mode="Transport">            <transport clientCredentialType="None" proxyCredentialType="None"                realm="" />            <message clientCredentialType="UserName" algorithmSuite="Default" />          </security>        </binding>      </basicHttpBinding>
      <wsHttpBinding>        <!-- added default behaviour of readerQuotas test -->        <binding>          <readerQuotas maxDepth="15" maxStringContentLength="524288" maxArrayLength="16384"          maxBytesPerRead="4096" maxNameTableCharCount="16384" />        </binding>        <binding name="BasicHttpBinding_Text" closeTimeout="00:10:00"            openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00"            allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"             maxBufferPoolSize="2147483646" maxReceivedMessageSize="2147483646"            messageEncoding="Text" textEncoding="utf-8"            useDefaultWebProxy="true">          <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483646" maxArrayLength="2147483647"              maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />          <security mode="Transport">            <transport clientCredentialType="None" proxyCredentialType="None"                realm="" />            <message clientCredentialType="UserName" algorithmSuite="Default" />          </security>        </binding>        <binding name="BasicHttpBinding_Mtom" closeTimeout="00:10:00"            openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00"            allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"             maxBufferPoolSize="2147483646" maxReceivedMessageSize="2147483646"            messageEncoding="Mtom" textEncoding="utf-8"            useDefaultWebProxy="true">          <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483646" maxArrayLength="2147483647"              maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />          <security mode="Transport">            <transport clientCredentialType="None" proxyCredentialType="None"                realm="" />            <message clientCredentialType="UserName" algorithmSuite="Default" />          </security>        </binding>      </wsHttpBinding>
        </bindings>

my problem is something similar to this thread.:http://entlib.codeplex.com/discussions/151278

but I'm using default name. should I still add "wcf exceptionshileding" in contracts?

Please help. 

Kavya

Feb 15, 2012 at 5:53 PM

Also, if I remove

<add name="Fusion Logging Exception Handler" type="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging.LoggingExceptionHandler, &#xD;&#xA;&#xD;&#xA;Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging, Version=5.0.414.0, Culture=neutral, &#xD;&#xA;&#xD;&#xA;PublicKeyToken=31bf3856ad364e35"              logCategory="General" eventId="100" severity="Error" title="Enterprise Library Exception Handling"              formatterType="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.TextExceptionFormatter, &#xD;&#xA;&#xD;&#xA;Microsoft.Practices.EnterpriseLibrary.ExceptionHandling"              priority="0" />

 

from the config, it raises a correct exception as FaultException<ServiceFault>

please help. does it need anything installed in GAc? currently all dlls are stored in another physical folder. 

Microsoft.Practices.EnterpriseLibrary.Common

Microsoft.Practices.EnterpriseLibrary.ExceptionHandling

Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging

Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.WCF

Microsoft.Practices.EnterpriseLibrary.Logging

Microsoft.Practices.ServiceLocation

Microsoft.Practices.Unity

 

Kavya

Feb 17, 2012 at 4:20 PM

You don't need to install the assemblies in the GAC but the assemblies do have to be resolvable by the runtime.  Usually this will be in the bin folder of the web application.  It sounds to me like the Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging.dll can't be found.  Is it deployed in the bin folder?

You could run Assembly Binding Log Viewer to see if there are any assemblies that cannot be loaded.    

--
Randy Levy
Enterprise Library support engineer
entlib.support@live.com 

Feb 22, 2012 at 4:44 PM

Thank you. it was a silly mistake.

Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging.dll was not in the bin. 

resolved it