Peter Kjaer (SDL)

October 10, 2011

Nostra culpa

Filed under: Audience Manager, Outbound E-mail — Tags: , , , , , , , — Peter Kjaer @ 11:20 PM

As software developers, we occasionally create defects. We know this, our testers know it, and our customers know it.
We constantly aim to improve the software that we write, to lower the number of bugs we produce. But we will produce them.

With that in mind, I want to talk about a particular issue in Audience Manager 2011 which has caused some confusion.

Read on for some insight into the background of the problem – or skip to the end for the solution.

The Background

SDL Tridion 2011 introduced the Core Service, a WCF replacement for the old Business Connector. As a result, my team needed to switch from using the Tridion Object Model to using the Core Service.

If you have ever worked with Windows Communication Foundation web services, you know that there is an awful lot of configuration needed to get it to work. Tools like Visual Studio will helpfully generate this configuration for you, but FSM help you if you need to change any of that.

Developers with a lot of experience in WCF have gotten used to it by now.
But we decided early on that we would spare our customers the trouble, if possible.

The Approach

We carefully considered our options. It was clear that using a wsHttp binding would be best when connecting to a remote machine, and a netTcp binding performed better when connecting to the local machine.

We settled on an implementation that required only a single line in our configuration file: the URL to the Core Service (defaulting to netTcp on localhost). Our code would check the URL and use either binding, based on the protocol used. We provided default settings that would fit most of our users.

Sounds good so far, doesn’t it? It is! It works nicely and is quite easy to configure.
In most cases, you don’t even need to touch that configuration setting.

The Problem

“But what if someone has a problem with our bindings and needs to change something?” we asked ourselves. And we added the ability to overwrite the default bindings by specifying one using the standard WCF configuration. You know, for the masochists out there.

And still everything was fine. It wasn’t until we added log messages to help you troubleshoot why your custom binding doesn’t work that we went astray — without realizing it.

Consider the following log messages:

2011-09-29T18:35:52      [Info] No valid WCF configuration found to create the CoreService.
The CoreService will be created using the CoreServiceUrl configured in the Audience Manager / Outbound E-mail configuration.
2011-09-29T18:35:52      [Error] Could not find default endpoint element that references contract 'AudienceManagerCoreServiceProxy.ISessionAwareCoreService2010'
 in the ServiceModel client configuration section.
This might be because no configuration file was found for your application, or because no endpoint element matching this contract could be found in the client element.
   at System.ServiceModel.Description.ConfigLoader.LoadChannelBehaviors(ServiceEndpoint serviceEndpoint, String configurationName)
   at System.ServiceModel.ChannelFactory.ApplyConfiguration(String configurationName, Configuration configuration)
   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.EndpointTrait`1.CreateSimplexFactory()
   at System.ServiceModel.ClientBase`1.CreateChannelFactoryRef(EndpointTrait`1 endpointTrait)
   at System.ServiceModel.ClientBase`1.InitializeChannelFactoryRef()
   at System.ServiceModel.ClientBase`1..ctor()
   at Tridion.AudienceManagement.DomainModel.ServiceClient.ContentManagerClient.GetConfiguredCoreService()
2011-09-29T18:35:52      [Info] Created NetTcpBinding binding for endpoint net.tcp://localhost:2660/CoreService/netTcp_2010.
2011-09-29T18:35:52      [Info] Loaded CoreService client in 25 milliseconds.

Let’s break that down:

  1. Audience Manager could not find a valid WCF binding for the Core Service.
  2. It logs an exception about endpoints and contracts. Note: these lines are only there if  you have set your log level to DEBUG.
  3. It creates a NetTcpBinding, despite what it wrote above.
  4. It successfully loads a Core Service client.

If you were trying to use a custom binding, those messages would be helpful in narrowing down the problem.

But if you are just using the default settings, you would see a huge error message and have no idea why it occurred or how to fix it.

In other words: while trying to help those who needed a custom WCF binding, we accidentally confused those who just used the default settings. Oops.

The Solution (2011 GA)

You can safely ignore those log messages. They are perfectly normal; you haven’t broken the system. You should probably turn down your log level so it isn’t set to “debug” for extended periods of time, though. It adds a lot of overhead and should only be used while troubleshooting.

The Solution (2011 SP1)

In Service Pack 1, we have changed the log messages to provide more clarity and generally be less scary:

2011-10-10T22:46:41	[Info] Contacting the Core Service using a pre-defined binding, as no valid custom binding was found.
2011-10-10T22:46:41	[Debug] If you intended to use a custom binding, the following information may help you troubleshoot the issue:
Could not find default endpoint element that references contract 'AudienceManagerCoreServiceProxy.ISessionAwareCoreService' in the ServiceModel client configuration section.
This might be because no configuration file was found for your application, or because no endpoint element matching this contract could be found in the client element.
   at System.ServiceModel.Description.ConfigLoader.LoadChannelBehaviors(ServiceEndpoint serviceEndpoint, String configurationName)
   at System.ServiceModel.ChannelFactory.ApplyConfiguration(String configurationName, Configuration configuration)
   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.EndpointTrait`1.CreateSimplexFactory()
   at System.ServiceModel.ClientBase`1.CreateChannelFactoryRef(EndpointTrait`1 endpointTrait)
   at System.ServiceModel.ClientBase`1.InitializeChannelFactoryRef()
   at System.ServiceModel.ClientBase`1..ctor()
   at Tridion.AudienceManagement.DomainModel.ServiceClient.SessionAwareCoreServiceClient..ctor()
   at Tridion.AudienceManagement.DomainModel.ServiceClient.CoreServiceProxy..ctor()
   at Tridion.AudienceManagement.DomainModel.ServiceClient.ContentManagerClient.GetConfiguredCoreService()

2011-10-10T22:46:41	[Info] Created NetTcpBinding binding for endpoint net.tcp://localhost:2660/CoreService/2011/netTcp.
2011-10-10T22:46:41	[Info] Loaded CoreService client in 22 milliseconds.

The Conclusion

If you have ever run into this error, I apologize for any confusion it might have caused.
At least you know the entire story now.

Sometimes you just miss the mark…

Advertisements

2 Comments »

  1. Hi Peter, thank you for the info above, I found it useful.
    In line 2 above, you are referring to a log where the message can be found, which log is this?

    Thanks!
    Elena

    Comment by Elena S — January 14, 2014 @ 6:53 PM

  2. “Tridion Audience Manager.w3wp.log” in the log directory configured in OutboundEmail.xml (typically “C:\Program Files (x86)\Tridion\Log”)

    Comment by Peter Kjaer — January 14, 2014 @ 8:42 PM


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: