Using RemoteServiceTraceListener in the latest Silverlight Integration Logging Block

Topics: Logging Application Block, Silverlight Integration Pack
Jun 15, 2011 at 2:06 PM

I am stuck at this problem from quite some time.  I am using the SilverLightLoggingDemo posted at http://entlib.codeplex.com/releases/view/63549.

The only change i am making is i am adding a ServiceReferences.ClientConfig File with the following Code

 

<configuration>
	<system.serviceModel>
		<bindings>
   <customBinding>
    <binding name="CustomBinding_ILoggingService">
     <binaryMessageEncoding />
     <httpTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" />
    </binding>
   </customBinding>
  </bindings>
		<client>
			<endpoint address="http://localhost:5957/LogService.svc" binding="customBinding"
                bindingConfiguration="CustomBinding_ILoggingService" contract="Microsoft.Practices.EnterpriseLibrary.Logging.Service.ILoggingService"
                name="CustomBinding_ILoggingService" />
		</client>
		
		

	</system.serviceModel>
</configuration>


and also defining the remote service trace listener to the existing configuration.xaml file

  Highlighted in Green

<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:el="clr-namespace:Microsoft.Practices.EnterpriseLibrary.Logging.Configuration;assembly=Microsoft.Practices.EnterpriseLibrary.Logging.Silverlight">

    <el:LoggingSettings DefaultCategory="default" x:Key="loggingConfiguration" LogWarningWhenNoCategoriesMatch="True">
        <el:LoggingSettings.TraceListeners>
            <el:NotificationTraceListenerData Name="event"/>
            <el:IsolatedStorageTraceListenerData Name="isolated" RepositoryName="test" />
            <el:RemoteServiceTraceListenerData LoggingServiceFactory="CustomBinding_ILoggingService" Name="remote"  SendImmediately="True" />
        </el:LoggingSettings.TraceListeners>
        <el:LoggingSettings.TraceSources>
            <el:TraceSourceData Name="default" DefaultLevel="All">
                <el:TraceSourceData.TraceListeners>
                    <el:TraceListenerReferenceData Name="event"/>
                    <el:TraceListenerReferenceData Name="remote"/>
                </el:TraceSourceData.TraceListeners>
            </el:TraceSourceData>
            <el:TraceSourceData Name="isolated" DefaultLevel="Error">
                <el:TraceSourceData.TraceListeners>
                    <el:TraceListenerReferenceData Name="isolated"/>
                    <el:TraceListenerReferenceData Name="remote"/>
                </el:TraceSourceData.TraceListeners>
            </el:TraceSourceData>
            <el:TraceSourceData Name="some operation" DefaultLevel="All">
                <el:TraceSourceData.TraceListeners>
                    <el:TraceListenerReferenceData Name="event"/>
                    <el:TraceListenerReferenceData Name="remote"/>
                </el:TraceSourceData.TraceListeners>
            </el:TraceSourceData>
        </el:LoggingSettings.TraceSources>
        <el:LoggingSettings.SpecialTraceSources>
            <el:SpecialTraceSourcesData>
                <el:SpecialTraceSourcesData.ErrorsTraceSource>
                    <el:TraceSourceData DefaultLevel="Warning">
                        <el:TraceSourceData.TraceListeners>
                            <el:TraceListenerReferenceData Name="event"/>
                        </el:TraceSourceData.TraceListeners>
                    </el:TraceSourceData>
                </el:SpecialTraceSourcesData.ErrorsTraceSource>
            </el:SpecialTraceSourcesData>
        </el:LoggingSettings.SpecialTraceSources>
    </el:LoggingSettings>

</ResourceDictionary>

So according to the developer Guide Provided i just need to create a web service with the same name defined in the clientconfig file as LogService.svc

So i Created a Asp.net web Service application with just one file of Name "LogService.svc" inside which there is just one line of code.

<%

@ ServiceHost Language="C#" Debug="true" Service="Microsoft.Practices.EnterpriseLibrary.Logging.Service.LoggingService"

%>




   
 







 

 

 and in the web.config file i defined

<?xml version="1.0"?>
<configuration>
	<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"/>
	</configSections>
	<loggingConfiguration name="Logging Application Block" tracingEnabled="true" defaultCategory="System.ServiceModel" logWarningsWhenNoCategoriesMatch="true">
		<listeners>
			<add fileName="c:\\trace-xml.log" listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.XmlTraceListenerData,Microsoft.Practices.EnterpriseLibrary.Logging" traceOutputOptions="None" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.XmlTraceListener,Microsoft.Practices.EnterpriseLibrary.Logging" name="XML Trace Listener"/>
		</listeners>
		<formatters>
		</formatters>
		<categorySources>
			<add switchValue="All" name="System.ServiceModel">
				<listeners>
					<add name="XML Trace Listener"/>
				</listeners>
			</add>
		</categorySources>
		<specialSources>
			<allEvents switchValue="All" name="All Events"/>
			<notProcessed switchValue="All" name="Unprocessed Category"/>
			<errors switchValue="All" name="Logging Errors &amp; Warnings"/>
		</specialSources>
	</loggingConfiguration>
	<system.serviceModel>
		<diagnostics>
			<messageLogging logEntireMessage="true" logMalformedMessages="true" logMessagesAtTransportLevel="true"/>
		</diagnostics>
		<bindings>
			<customBinding>
				<binding name="Microsoft.Practices.EnterpriseLibrary.Logging.Service.customBinding">
					<binaryMessageEncoding/>
					<httpTransport/>
				</binding>
			</customBinding>
		</bindings>
		<services>
			<service name="Microsoft.Practices.EnterpriseLibrary.Logging.Service.LoggingService" behaviorConfiguration="MyServiceTypeBehaviors">
				<endpoint address="" binding="customBinding" bindingConfiguration="Microsoft.Practices.EnterpriseLibrary.Logging.Service.customBinding" contract="Microsoft.Practices.EnterpriseLibrary.Logging.Service.ILoggingService"/>
				<endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex"/>
			</service>
		</services>
		<behaviors>
			<serviceBehaviors>
				<behavior name="MyServiceTypeBehaviors">
					<serviceMetadata httpGetEnabled="true"/>
				</behavior>
			</serviceBehaviors>
		</behaviors>
	</system.serviceModel>
	<system.diagnostics>
		<sources>
			<source name="System.ServiceModel" switchValue="All">
				<listeners>
					<add name="traceListener" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.EntLibLoggingProxyTraceListener,Microsoft.Practices.EnterpriseLibrary.Logging"/>
				</listeners>
			</source>
		</sources>
	</system.diagnostics>
	<system.web>
		<compilation debug="true"/></system.web></configuration>

Still nothing is getting reflected on my logs.....Please Help!!!! I am stuck big time with this problem
Jun 15, 2011 at 4:46 PM

We'll try and look into this and get back to you for any updates.

Gino Terrado
Global Technologies and Solutions
Avanade, Inc.
entlib.support@avanade.com

Jun 17, 2011 at 2:06 PM

Thanks a lot...i am also trying but still not able to find the solution. Although this is the expected behavior

Jun 21, 2011 at 7:07 PM

Is there any updates on this?

Thx.

Jun 24, 2011 at 11:20 AM

Any new news?

Jun 24, 2011 at 8:00 PM

Hello,

Sorry it took me some time to get back to you on this. I would not pinpoint what exactly is wrong with how have you implemented using Remote Service TraceListener, let me just summarize how I was able to make it to work.

Same with the documentation I just followed the outlined steps

1. Add the log service to your web server

 - Basically, in my solution I only have 2 projects. One is the Silverlight App project and the 2nd is the Web App project that hosting the Silverlight App. Actually these 2 projects is the default project when creating an SL App.

 - In my Web project, as instructed in the documentation I've added the required assembly references - Microsoft.Practices.EnterpriseLibrary.Common.dll, Microsoft.Practices.EnterpriseLibrary.Logging.dll and Microsoft.Practices.EnterpriseLibrary.Logging.Service.dll

 - And then, still in the Web project, I've added the LogService.svc file or service with the contents of "<%@ ServiceHost Language="C#" Debug="true" Service="Microsoft.Practices.EnterpriseLibrary.Logging.Service.LoggingService" %>"

 

2. Configure the Logging Application Block on the web server

 - In the Web project web.config you would need to configure the Logging Application Block and the binding that will be used by the Log Service.

 - Note that the Log Categories Name defined here should have the same Category Name from what is configured Log Category in the Silverlight App layer. Meaning if you have written a log entry in the SL layer to Log Category named "General" then the Log Service would also look for a Log Category named "General" from the configured Logging App Block in your Web Project. Therefore this should be in synch so that it would not throw up an error looking for an explicit mapping for a specific category.

 - Please see sample used web.config below

<?xml version="1.0"?>
  <!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=169433
  -->

<configuration>
    <configSections>
        <section name="loggingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="true" />
    </configSections>
    <loggingConfiguration name="" tracingEnabled="true" defaultCategory="default">
        <listeners>
            <add name="Event Log Listener" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.FormattedEventLogTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
                listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.FormattedEventLogTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
                source="Enterprise Library Logging" formatter="Text Formatter"
                log="" machineName="." traceOutputOptions="None" />
            <add name="Flat File Trace Listener" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.FlatFileTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
                listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.FlatFileTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
                fileName="c:\temp\trace.log" />
        </listeners>
        <formatters>
            <add type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
                template="Timestamp: {timestamp}{newline}&#xA;Message: {message}{newline}&#xA;Category: {category}{newline}&#xA;Priority: {priority}{newline}&#xA;EventId: {eventid}{newline}&#xA;Severity: {severity}{newline}&#xA;Title:{title}{newline}&#xA;Machine: {localMachine}{newline}&#xA;App Domain: {localAppDomain}{newline}&#xA;ProcessId: {localProcessId}{newline}&#xA;Process Name: {localProcessName}{newline}&#xA;Thread Name: {threadName}{newline}&#xA;Win32 ThreadId:{win32ThreadId}{newline}&#xA;Extended Properties: {dictionary({key} - {value}{newline})}"
                name="Text Formatter" />
        </formatters>
        <categorySources>
            <add switchValue="All" name="default">
                <listeners>
                    <add name="Event Log Listener" />
                    <add name="Flat File Trace Listener" />                  
                </listeners>
            </add>
        </categorySources>
        <specialSources>
            <allEvents switchValue="All" name="All Events" />
            <notProcessed switchValue="All" name="Unprocessed Category" />
            <errors switchValue="All" name="Logging Errors &amp; Warnings">
                <listeners>
                    <add name="Event Log Listener" />
                </listeners>
            </errors>
        </specialSources>
    </loggingConfiguration>
    <system.web>
        <compilation debug="true" targetFramework="4.0" />
    </system.web>

    <system.serviceModel>
      <bindings>
        <customBinding>
        <binding name="Microsoft.Practices.EnterpriseLibrary.Logging.Service.customBinding">
          <binaryMessageEncoding />
          <httpTransport />
        </binding>
        </customBinding>
      </bindings>
      <services>
        <service name="Microsoft.Practices.EnterpriseLibrary.Logging.Service.LoggingService">
          <endpoint address="" binding="customBinding" bindingConfiguration="Microsoft.Practices.EnterpriseLibrary.Logging.Service.customBinding"
           contract="Microsoft.Practices.EnterpriseLibrary.Logging.Service.ILoggingService" />
        </service>
      </services>

    </system.serviceModel>
</configuration>

3. Configure the WCF binding in the Silverlight application

 - In the Silverlight App project, you will then need to configure your ServiceReferences.ClientConfig and by default implementation should be look like as below.

 - Note that the address property on the endpoint element refers to the location where your service endpoint is located. In this case, it assumes that the service endpoint is located on the same server where the XAP file was deployed. If the logging service is located in a different location, or if you have given your SVC file a different name, you should change this URL.

<configuration>
    <system.serviceModel>
      <bindings>
        <customBinding>
          <binding name="CustomBinding_ILoggingService">
            <binaryMessageEncoding />
            <httpTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" />
          </binding>
        </customBinding>
      </bindings>
      <client>
        <endpoint address="/LoggingService.svc"
            binding="customBinding" bindingConfiguration="CustomBinding_ILoggingService"
            contract="Microsoft.Practices.EnterpriseLibrary.Logging.Service.ILoggingService" name="CustomBinding_ILoggingService" />
      </client>     
    </system.serviceModel>
</configuration>

4. Configure the Logging Application Block to use the Remote Service trace listener

- In Silverlight App project, you just need to configure your Remote Service Tracelistener here (same with your xaml configuration above)

<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:el="clr-namespace:Microsoft.Practices.EnterpriseLibrary.Logging.Configuration;assembly=Microsoft.Practices.EnterpriseLibrary.Logging.Silverlight">

    <el:LoggingSettings DefaultCategory="default" x:Key="loggingConfiguration" LogWarningWhenNoCategoriesMatch="True">
        <el:LoggingSettings.TraceListeners>
            <el:NotificationTraceListenerData Name="event"/>
            <el:IsolatedStorageTraceListenerData Name="isolated" RepositoryName="test" />
            <el:RemoteServiceTraceListenerData LoggingServiceFactory="CustomBinding_ILoggingService" Name="remote"  SendImmediately="True" />
        </el:LoggingSettings.TraceListeners>
        <el:LoggingSettings.TraceSources>
            <el:TraceSourceData Name="default" DefaultLevel="All">
                <el:TraceSourceData.TraceListeners>
                    <!--<el:TraceListenerReferenceData Name="event"/>-->
                    <el:TraceListenerReferenceData Name="remote"/>
                </el:TraceSourceData.TraceListeners>
            </el:TraceSourceData>
            <el:TraceSourceData Name="isolated" DefaultLevel="Error">
                <el:TraceSourceData.TraceListeners>
                    <el:TraceListenerReferenceData Name="isolated"/>
                    <el:TraceListenerReferenceData Name="remote"/>
                </el:TraceSourceData.TraceListeners>
            </el:TraceSourceData>
            <el:TraceSourceData Name="some operation" DefaultLevel="All">
                <el:TraceSourceData.TraceListeners>
                    <el:TraceListenerReferenceData Name="event"/>
                    <el:TraceListenerReferenceData Name="remote"/>
                </el:TraceSourceData.TraceListeners>
            </el:TraceSourceData>
        </el:LoggingSettings.TraceSources>
        <el:LoggingSettings.SpecialTraceSources>
            <el:SpecialTraceSourcesData>
                <el:SpecialTraceSourcesData.ErrorsTraceSource>
                    <el:TraceSourceData DefaultLevel="Warning">
                        <el:TraceSourceData.TraceListeners>
                            <el:TraceListenerReferenceData Name="remote"/>
                        </el:TraceSourceData.TraceListeners>
                    </el:TraceSourceData>
                </el:SpecialTraceSourcesData.ErrorsTraceSource>
            </el:SpecialTraceSourcesData>
        </el:LoggingSettings.SpecialTraceSources>
    </el:LoggingSettings>

</ResourceDictionary>

Then that's it. You should now be able to log in the event log and also in a flat file that triggered by a Silverlight App using a Remote Service TraceListener.

Hope this helps.

Gino Terrado
Global Technologies and Solutions
Avanade, Inc.
entlib.support@avanade.com

Jun 27, 2011 at 6:52 AM

OK let me try this approach ....also in your silverlight app did you use the default Writer.write Function?

Jun 27, 2011 at 8:26 AM

Yup :o)

Gino Terrado
Global Technologies and Solutions
Avanade, Inc.
entlib.support@avanade.com

Jun 27, 2011 at 7:41 PM

Did Exactly what you told but when i compile the silverlight web application it gives me warning...
 Found conflicts between different versions of the same dependent assembly.

if i remove either Microsoft.Practices.EnterpriseLibrary.Logging version=5.0.414.0  RunTime version= v2.0.50727 or Microsoft.Practices.EnterpriseLibrary.Logging.Service version=5.0.505.0 RunTime version= v2.0.50727

the warning goes away .

if i add both i get the following error in the application Log

WebHost failed to process a request.

Sender Information: System.ServiceModel.ServiceHostingEnvironment+HostingManager/35841405

Exception: System.ServiceModel.ServiceActivationException: The service '/LogService.svc' cannot be activated due to an exception during compilation. The exception message is: Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040). ---> System.IO.FileLoadException: Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

at System.Signature.GetSignature(SignatureStruct& signature, Void* pCorSig, Int32 cCorSig, RuntimeFieldHandleInternal fieldHandle, IRuntimeMethodInfo methodHandle, RuntimeType declaringType)

at System.Signature..ctor(IRuntimeMethodInfo methodHandle, RuntimeType declaringType)

at System.Reflection.RuntimeConstructorInfo.GetParametersNoCopy()

at System.RuntimeType.FilterApplyMethodBase(MethodBase methodBase, BindingFlags methodFlags, BindingFlags bindingFlags, CallingConventions callConv, Type[] argumentTypes)

at System.RuntimeType.GetConstructorCandidates(String name, BindingFlags bindingAttr, CallingConventions callConv, Type[] types, Boolean allowPrefixLookup)

at System.RuntimeType.GetConstructorImpl(BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers)

at System.Type.GetConstructor(BindingFlags bindingAttr, Binder binder, Type[] types, ParameterModifier[] modifiers)

at System.ServiceModel.Dispatcher.InstanceBehavior..ctor(DispatchRuntime dispatch, ImmutableDispatchRuntime immutableRuntime)

at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime..ctor(DispatchRuntime dispatch)

at System.ServiceModel.Dispatcher.DispatchRuntime.GetRuntimeCore()

at System.ServiceModel.Dispatcher.ChannelDispatcher.OnOpened()

at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)

at System.ServiceModel.ServiceHostBase.OnOpen(TimeSpan timeout)

at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)

at System.ServiceModel.Channels.CommunicationObject.Open()

at System.ServiceModel.ServiceHostingEnvironment.HostingManager.ActivateService(String normalizedVirtualPath)

at System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath)

--- End of inner exception stack trace ---

at System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath)

at System.ServiceModel.ServiceHostingEnvironment.EnsureServiceAvailableFast(String relativeVirtualPath)

Process Name: WebDev.WebServer40

Process ID: 5212

 

 

 

Jun 28, 2011 at 10:46 AM

The obvious difference is that you're still using Microsoft.Practices.EnterpriseLibrary.Logging version=5.0.414.0. Which should not be the case if you have already upgraded to Silverlight Integration Pack. The correct version is 5.0.505.0. What I can suggest is to double check the references of the entlib assemblies you're using.

Gino Terrado
Global Technologies and Solutions
Avanade, Inc.
entlib.support@avanade.com

 

Jul 2, 2011 at 8:47 AM

Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

This server has Enterprise Silverlight Integration Pack installed and i can see the assembly when i add to the reference.

Jul 2, 2011 at 11:09 AM

It seem my machine got Corrupted so reinstalled everything from scratch....the service started working and eveything that you told just did the same no Error in application log and no error in execution but still nothing is being written on the service..

Can you please share your temporary project that you said was working fine.

Jul 3, 2011 at 12:10 PM

Drop us a mail, so we would know where to send it.

Gino Terrado
Global Technologies and Solutions
Avanade, Inc.
entlib.support@avanade.com

Jul 11, 2011 at 9:43 PM

The example you gave, which I cut and pasted the code, does not work for remote trace listener.  Can you forward me the example please?  I emailed you about it already.

Jul 12, 2011 at 4:16 AM

I've sent  you the sample solution.

 

Noel Angelo Bolasoc
Global Technologies and Solutions
Avanade, Inc.
entlib.support@avanade.com

Jul 12, 2011 at 5:33 AM

Sorry but I have not received it yet.  

Jul 12, 2011 at 6:56 AM

I have resend it to your other email. Kindly check.

 

Noel Angelo Bolasoc
Global Technologies and Solutions
Avanade, Inc.
entlib.support@avanade.com

Jul 21, 2011 at 6:22 AM

sorry to say your example on my machine did not log anything to the log file or event.

I am running in Visual Studio 2010 Ultimate as an Administrator, I double checked all the dll's versions and they all are version 505.

 I used to get an error when the service was not found, and that no longer happens, so I am assuming it is finding the service and logging,

but I am not getting anything logged.  

Any suggestions?

I have not made a single change to your application.

 

Jul 21, 2011 at 10:03 AM

Unfortunately, we weren't able to reproduce your issue. Everything works fine in our side. Have you noticed any error logs on your event viewer? I'm just thinking you might miss something here but its hard to tell what is it exactly. You can try reinstalling the Microsoft Enterprise Library 5.0 Optional Update 1 and see if it solves the issue.

 

Noel Angelo Bolasoc
Global Technologies and Solutions
Avanade, Inc.
Contact Us

Jul 21, 2011 at 3:47 PM

Hello Noel,

is it possible to get also your example code?
Maybe it is also possible that anybody update the logging example on
http://entlib.codeplex.com/releases/view/63549
with using logging via wcf service.
In march, when the example has been released, the WCF logging featurehasn't be implemented in the Entlib Silverlight 5.0.

Regards
Dirk

 

Jul 22, 2011 at 7:02 AM

Hi,

Drop us an email so we can know where to send it.

 

Noel Angelo Bolasoc
Global Technologies and Solutions
Avanade, Inc.
Contact Us

Aug 25, 2011 at 7:55 PM

Hi Noel

Can you send me your example code?

Thanks in advance

Aug 26, 2011 at 3:12 AM

Hi,

Sample sent! Let us know if you received it.

 

Noel Angelo Bolasoc
Global Technologies and Solutions
Avanade, Inc.
Contact Us

Aug 26, 2011 at 1:08 PM

Guys, I’m experiencing same bad stuff. I even created new solutions and copy-pasted all you config from above. But still it looks like remote service simply ignores any messages.

I enabled metada and runed WCF Test Client so I can see that service is really runing and there is one and only method Add() in ILoggingService available. But everytime I’m trying to log, log message doesn’t appear in application section of event viewer.

The same config works well for ordinary console application (entries are present in event viewer) but not when it comes to service.

<system.serviceModel>
		<bindings>
			<customBinding>
				<binding name="Microsoft.Practices.EnterpriseLibrary.Logging.Service.customBinding">
					<binaryMessageEncoding />
					<httpTransport />
				</binding>
			</customBinding>
		</bindings>
		<services>
			<service name="Microsoft.Practices.EnterpriseLibrary.Logging.Service.LoggingService"
				 behaviorConfiguration="CarePlanService.Service1Behavior">
				<endpoint address=""
						  binding="customBinding"
						  bindingConfiguration="Microsoft.Practices.EnterpriseLibrary.Logging.Service.customBinding"
						  contract="Microsoft.Practices.EnterpriseLibrary.Logging.Service.ILoggingService" />
				<endpoint address="mex"
						  binding="mexHttpBinding"
						  contract="IMetadataExchange" />
 
			</service>
		</services>
		<behaviors>
			<serviceBehaviors>
				<behavior name="CarePlanService.Service1Behavior">
					<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
					<serviceMetadata httpGetEnabled="true"/>
					<!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
					<serviceDebug includeExceptionDetailInFaults="false"/>
				</behavior>
			</serviceBehaviors>
		</behaviors>
 
	</system.serviceModel>
Aug 26, 2011 at 3:47 PM

piskov,

I agree with you I was not able to get the sample running.  Running into the same issues you described.  

Please keep me updated it if you solved it and I will do the same.

Thank you.

 

Aug 31, 2011 at 6:54 AM

Hi piskov,

Can you try replicating the same using a Flat File? My initial guess here is that your application doesn't have enough rights to write into event log.

 

Noel Angelo Bolasoc
Global Technologies and Solutions
Avanade, Inc.
Contact Us

Aug 31, 2011 at 9:35 AM

Yep, same shit — no entries neither in file nor in event log. I think it’s not about rights: I’m admin, UAC is off, console app writing to event log or my silverlight app writing to isolated storage work just fine. It just don’t work when it comes to a service.

 

It’s not a big issue though — I don’t need logging service in production but it would really help in development (coz viewing and filtering log items in event viewer is far more pleasant  than looking through isolated storage). It just pissing me off that this thing isn‘t working and not showing any errors so I can figure out why this is happening.

Aug 31, 2011 at 10:24 AM

Maybe it would be better if you can send us a small repro project so we can further assess the issue. You can send it at entLib.support@avanade.com.

 

Noel Angelo Bolasoc
Global Technologies and Solutions
Avanade, Inc.
Contact Us

Aug 31, 2011 at 10:42 AM

It’s nothing else but your example from Jun 24 at 11:00 PM (however I tried my configs too, same shit, isolated storage is working, logging service — not).

I created new WCF Service application, removed sample service files, added via Nuget remove logging service, pasted your code for svc and web.config.

Then created silverlight app, added via Nuget logging block, pasted your code for ServiceReferences.ClientConfig and Configuration.xaml, checked all build actions and added one log entry to logwriter on start-up — that’s it.

May be the problem lies within the nuget libraries?

On my machine I have silverlight 5 beta (however this sample project is in silverlight 4), entlib config tool via extension for vs, all other stuff is coming via nuget.

 

I did this may be five or six times from scratch — nothing happened. May be if you have any working example (i deleted mines), I will appreciate having it at andrey.piskov on g m a  i l.

Aug 31, 2011 at 2:00 PM

Ok, your sample works just fine and helped me figure out what is really going wrong (actually i found the effects but not the reason).

All this won’t work if svc file is defined in some project other than hosting your silverlight app.

So assume you’ve built and started that project with standalone svc and have its address, for example: http://localhost:28434/LoggingService.svc.

If then you go to your silverlight project and change ServiceReferences.ClientConfig so that “<endpoint address="/LoggingService.svc"...”will be “<endpoint address="http://localhost:28434/LoggingService.svc"...”, and then run silverlight app you will see no messages in the event log.

But if your svc is in the same asp project hosting your silverlight app and in clientconfig you have <endpoint address="/LoggingService.svc everything works just fine.

 

You can simulate this with your sample solution by making a copy of it. Start original solution and remember service address, then in the other solution delete loggingservice from asp project and in the silverlight project replace endpoint address with the remembered one. If you then start this solution and press log button, no new events will be present in the event viewer.

Aug 31, 2011 at 6:25 PM

If I understand you correctly, you have this working.  Is this right?

If it is, can you forward me the updated solution please.

 

Aug 31, 2011 at 7:19 PM

yep, give me your email

Sep 13, 2011 at 9:09 PM

Please send to me as well, I can't get it to log

thanks!

Sep 14, 2011 at 7:06 AM

Hi lionel1,

Kindly drop us an email at entlib.support@avanade.com.

 

Noel Angelo Bolasoc
Avanade Software
Avanade, Inc.
Contact Us

Sep 14, 2011 at 1:40 PM

email sent

Sep 15, 2011 at 4:22 AM

Sample sent. Let us know if you received it. Thanks!

 

Noel Angelo Bolasoc
Avanade Software
Avanade, Inc.
Contact Us

Sep 21, 2011 at 2:44 PM

Hi Gino

i followed your post and everything is normal i can get to my WCF service, i was able to add the reference to my SL application, the only difference is that i used "Email Listener" do you have any sample for "Email Listener"?

can you email (afshin@tekanalysts.com) or post a sample that shows how to use the service contract="Microsoft.Practices.EnterpriseLibrary.Logging.Service.ILoggingService" in silverlight 4 app.

thank you in advanced.

Sep 23, 2011 at 9:16 AM

Hi,

Apologies but we don't have a sample application for Email Tracelistener. Anyway, this link would help you to get started. Hope this helps.

 

Noel Angelo Bolasoc
Avanade Software
Avanade, Inc.
Contact Us

Sep 23, 2011 at 3:15 PM

Hi ,

thanks for the link and your response, i actually have an email trace listener already in place for the WCF (Server) part, i was wondering if i could implement one for Silverlight (Client) using contract="Microsoft.Practices.EnterpriseLibrary.Logging.Service.ILoggingService" without writing a WCF service email?

Sep 26, 2011 at 10:12 AM

Unfortunately, sending email directly from client is not supported in Silverlight. You still need to use a service to achieve this.

 

Noel Angelo Bolasoc
Avanade Software
Avanade, Inc.
Contact Us

 

Sep 28, 2011 at 12:26 AM

thanks Noel

Oct 26, 2011 at 7:25 PM

Hello Noel,

Would you please send me a copy of that example code for RemoteServiceTraceListener, too?

I'll be sending my email address to entlib.support@avanade.com and your "Contact Us" link, momentarily.

I've tried your example from your Jun 24 post above, and I'm running into this problem ( http://entlib.codeplex.com/discussions/272374 ), though I haven't been able to resolve it.

 

Oct 26, 2011 at 8:06 PM

Willy, please email entlib.support@live.com with the inquiry.

Mar 13, 2012 at 11:05 PM
AvanadeSupport wrote:

I've sent  you the sample solution.

 

Noel Angelo Bolasoc
Global Technologies and Solutions
Avanade, Inc.
entlib.support@avanade.com


Hi, I have read all the reply regarding to Entlib 5 logging for silverlight, I have done everything exactly as you said,

I got compiling error:

Error 53 The type or namespace name 'LogEntryMessage' does not exist in the namespace 'ServiceReference.Microsoft.Practices.EnterpriseLibrary.Logging.Service' (are you missing an assembly reference?) 

I have checked all references , they are correct as you described and according to developer's guide, I just can't get

rid of this error,  can you help please?

Can you drop me the working solution please?   to email:   yin.vivian.lee@gmail.com

Thank you very much!!

Mar 13, 2012 at 11:24 PM

Thank you very much for the quick reply.

Let me look at the sample solution and let you know.

Thanks again.

 

Mar 14, 2012 at 12:24 AM

I didn't receive the sample solution, can you send it again please

Mar 14, 2012 at 1:18 AM
Edited Apr 4, 2013 at 4:00 AM
You can find a Silverlight Remote Service Trace Listener Sample on the Enterprise Library Sample Projects page.

--Randy Levy
Enterprise Library support engineer
entlib.support@live.com 
Mar 14, 2012 at 2:55 PM
weilinewfl wrote:
AvanadeSupport wrote:

I've sent  you the sample solution.

 

Noel Angelo Bolasoc
Global Technologies and Solutions
Avanade, Inc.
entlib.support@avanade.com


Hi, I have read all the reply regarding to Entlib 5 logging for silverlight, I have done everything exactly as you said,

I got compiling error:

Error 53 The type or namespace name 'LogEntryMessage' does not exist in the namespace 'ServiceReference.Microsoft.Practices.EnterpriseLibrary.Logging.Service' (are you missing an assembly reference?) 

I have checked all references , they are correct as you described and according to developer's guide, I just can't get

rid of this error,  can you help please?

Can you drop me the working solution please?   to email:   yin.vivian.lee@gmail.com

Thank you very much!!

Noel:

Can you drop me the sample solution for silverlight logging using entlib 5.0 you mentioned in this thread,

I need to see , as I did exactly the same as described here, but I have the above compiling error.

Thanks

Mar 14, 2012 at 4:39 PM
randylevy wrote:

You cand find a Silverlight Remote Service Trace Listener Sample on the Enterprise Library Sample Projects page.

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


Hi, randy:

Thanks for pointing for the sample project.  The sample I downloaded runs well.

BUt when I do the same in my project, I got compiling error:

The type or namespace name 'TraceEventType' does not exist in the namespace 'System.Diagnostics' (are you missing an assembly reference?) 

Can you point out what could cause this?  Thanks a lot

Mar 14, 2012 at 5:22 PM

I don't believe System.Diagnostics.TraceEventType is available in Silverlight.  Because of this Enterprise Library uses it's own enum with Silverlight: Microsoft.Practices.EnterpriseLibrary.Logging.Diagnostics.TraceEventType.

If you have any other issues please start a new thread about your specific issue.

Thanks,

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

Mar 14, 2012 at 8:07 PM
randylevy wrote:

I don't believe System.Diagnostics.TraceEventType is available in Silverlight.  Because of this Enterprise Library uses it's own enum with Silverlight: Microsoft.Practices.EnterpriseLibrary.Logging.Diagnostics.TraceEventType.

If you have any other issues please start a new thread about your specific issue.

Thanks,

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


Hi, randy:  Thanks for the reply.  you are right about the "System.Diagnostics.TraceEventType" question, after I

changed the logging.silverlight.dll, that error disappeared.

Now when compiling, silverlight project created a file"ServiceReference.cs" under a generated folder "generatedWCFClientCode",

in this file have a compiling error: 

type or namespace name 'LogEntryMessage' does not exist in the namespace 'ServiceReference.Microsoft.Practices.EnterpriseLibrary.Logging.Service' (are you missing an assembly reference?) 

I checked DLL I am using is from the sample solution Downloaded from your link ,    any you please point out what I might correct?

 

Thank you very much!!!! 

Dec 2, 2012 at 10:41 AM

Hi,

I am getting the below error after implimenting the Entlib5.0 with WCF.

An error occurred creating the configuration section handler for exceptionHandling: Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.WCF, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Could you please help me out on this?

Dec 3, 2012 at 5:42 AM

@mracharjya, I created a new post for your issue.

Also, it helps to create a new thread unless the posting is directly related to an existing thread.

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