SL 4.0 Example

Apr 5, 2012 at 10:34 AM
Edited Apr 5, 2012 at 11:13 AM

Hi Daniel,

I don't want to reevent the wheel and I really like the job you did here. I tried the codeproject example and try to implement your solution with the latest version and log4net (which I already use for my app), and impossible to put it in place.

Do you have a simple example for the stupid user I am ?

This is what I have all the time :

Unable to use WCF config for channel. Using default configuration. This may be acceptable if no end point has been defined.   Cannot find 'ServiceReferences.ClientConfig' in the .xap application package. This file is used to configure client proxies for web services, and allows the application to locate the services it needs. Either include this file in the application package, or modify your code to use a client proxy constructor that specifies the service address and binding explicitly. Please see inner exception for details.     at System.ServiceModel.Configuration.ServiceModelSectionGroup.GetSectionGroup()   at System.ServiceModel.Configuration.ServiceModelSectionGroup.get_Current()   at System.ServiceModel.Description.ConfigLoader.LookupChannel(String configurationName, String contractName, Boolean wildcard)   at System.ServiceModel.Description.ConfigLoader.LoadChannelBehaviors(ServiceEndpoint serviceEndpoint, String configurationName)   at System.ServiceModel.ChannelFactory.ApplyConfiguration(String configurationName)   at System.ServiceModel.ChannelFactory.InitializeEndpoint(String configurationName, EndpointAddress address)   at System.ServiceModel.ChannelFactory`1..ctor(String endpointConfigurationName, EndpointAddress remoteAddress)   at System.ServiceModel.ChannelFactory`1..ctor(String endpointConfigurationName)   at DanielVaughan.ServiceModel.ChannelManagerSingleton.GetChannel[TChannel]()   at DanielVaughan.Logging.Log.GetClogService()

Not sending message to server. Reason: Log not enabled on server. Check filters if this is unexpected.   Not sending message to server. Reason: Log not enabled on server. Check filters if this is unexpected.   Not sending message to server. Reason: Log not enabled on server. Check filters if this is unexpected.   Not sending message to server. Reason: Log not enabled on server. Check filters if this is unexpected.   

 

If I well understood, the first it's normal as no endpoint has been defined but you do it by yourself if you have this exception, so after it has to work. In my web config, everything is define like on code project.

Thanks

Coordinator
Apr 5, 2012 at 1:08 PM

Hi there,

I recommend downloading the latest version, if you haven't already done so, from the Calcium repository at http://calcium.codeplex.com/sourcecontrol/list/changesets?ProjectName=calcium

In it there is a ClogFull.sln solution that has an example projects for WPF, Silverlight, and the server side.

Cheers,

Daniel

Apr 10, 2012 at 4:20 PM

Hi Daniel,

thanks for the reply and sorry for the late answer (too much work to look at it). Actually, I took calcium-91837 code and play with it and yes your code works ;o)) I tried to reproduce exactly the same as you but I still have this error : "Not sending message to server. Reason: Log not enabled on server. Check filters if this is unexpected." And when I looked deeper in your source codes, I've an exception at this step :

logStrategy = (ILogStrategy)Activator.CreateInstance(type);

=> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.TypeInitializationException: The type initializer for 'DanielVaughan.Logging.LogStrategies.Log4NetStrategy' threw an exception. ---> System.IO.FileLoadException: Could not load file or assembly 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

As explained in other posts, I reloaded the Log4NetLogStrategy but now way, it doesn't work. I know that at the end I will find but I'm sure it's easier for you. 

 

Maybe it's related to the fact that I'm using the latest log4net version 1.2.11 and that I put this in my webconfig :

<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net"/>

 

Thanks in advance for your time...

 

ps: I can ensure you I already tried several hours.

cheers,

Apr 11, 2012 at 9:40 AM

Hi Daniel,

after writting my error yesterday, I tought and actually the answer was in it :o) I took your code of "Log4NetLogStrategy" remove the ref of log4net 2.10 and ref log4net 2.11, I regenerate the dll and miracle it worked :o)

I think it would be great you publish a full version of CLog with the latest dll in your examples. It would be great for stupid users like me ;o)

 

cheers and really good job !!!

Coordinator
Apr 12, 2012 at 11:08 AM

Thanks for investigating this. I wasn't aware that a new version of Log4Net was out. The first one in years eh. ;)

I will integrate it.

Cheers,

Daniel

May 16, 2013 at 10:41 PM
I had the exact same problem, thanks MCoddens
saved me some unnecessary grief.

CRS.