I have a Tridion 2013 Event System extension DLL that references a few other DLLs. The referenced DLLs are present in the C:\Program Files (x86)\Tridion\bin
folder and is doing its job fine when relevant events are fired either in the CME or via the Core Service.
However, if the Core Service is recycled or restarted, on the 1st request to the Core Service (and only on the 1st request; subsequent requests are fine). I get the following exception:
Initialization of the extension '<path to extension>' failed.
Could not load file or assembly '<qualified assembly reference>' or one of its
dependencies. The system cannot find the file specified.
Component: Tridion.ContentManager.CoreService
Errorcode: 0
User: NT AUTHORITY\NETWORK SERVICE
StackTrace Information Details:
at Client.Tridion.Events.GuidelinesHandler..ctor()
at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly,
Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor,
Boolean& bNeedSecurityCheck)
at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis,
Boolean fillCache, StackCrawlMark& stackMark)
at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly,
Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at System.Activator.CreateInstance(Type type)
at Tridion.ContentManager.Extensibility.TcmExtension.LoadExtensions()
at Tridion.ContentManager.Extensibility.TcmExtension.LoadExtensions()
at Tridion.ContentManager.Extensibility.TcmExtension.InitializeExtensions()
at Tridion.ContentManager.Session..ctor(IEnumerable claimSets)
at Tridion.ContentManager.CoreService.CoreServiceBase.get_CurrentSession()
at Tridion.ContentManager.CoreService.CoreServiceBase.GetList(String id,
SubjectRelatedListFilterData filter)
at SyncInvokeGetList(Object , Object[] , Object[] )
at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance,
Object[] inputs, Object[]& outputs)
at Tridion.ContentManager.CoreService.CoreServiceInvoker.Invoke(Object instance,
Object[] inputs, Object[]& outputs)
at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(
MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(
MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(
MessageRpc& rpc)
at System.ServiceModel.Dispatcher.MessageRpc.Process(
Boolean isOperationContextSet)
I don't want to have to GAC install the referenced DLLs as its obviously working after the first request.
Its like the first startup has a different working directory, and then starts looking in the right place for subsequent requests.
Any help diagnosing or resolving this issue would be much appreciated.
UPDATE
This is the Core Service client creation code:
public static ICoreService Create(string host, string user, string password)
{
var binding = new BasicHttpBinding
{
MaxBufferSize = 4194304,
MaxBufferPoolSize = 4194304,
MaxReceivedMessageSize = 4194304,
ReaderQuotas = new XmlDictionaryReaderQuotas
{
MaxStringContentLength = 4194304,
MaxArrayLength = 4194304
},
Security = new BasicHttpSecurity
{
Mode = BasicHttpSecurityMode.TransportCredentialOnly,
Transport = new HttpTransportSecurity
{
ClientCredentialType = HttpClientCredentialType.Windows
}
}
};
var endpoint =
new EndpointAddress(host + "webservices/CoreService2012.svc/basicHttp");
var factory = new ChannelFactory<ICoreService>(binding, endpoint);
if (factory.Credentials != null)
{
factory.Credentials.Windows.ClientCredential =
new NetworkCredential(user, passsword);
}
return factory.CreateChannel();
}
UPDATE 2
This is the GuidelinesHandler's constructor, however, I'm pretty sure the code inside here isn't throwing the exception... Activator.CreateInstance
will attempt to invoke the ctor and part of this process is attempting to resolve any required DLLs.
I'm going to try enabling fusion logging on the server and see if I can get any more information on where its looking for the DLLs.
public GuidelinesHandler()
{
try
{
SolrNet.Startup.Init<GuidelinesResult>(_solrUrl);
}
catch (Exception ex)
{
Log("Error initializing SolrNet: {0}".FormatWith(ex), TraceEventType.Error);
}
EventSystem.SubscribeAsync<Component, CheckInEventArgs>(CheckIn,
EventPhases.TransactionCommitted);
EventSystem.SubscribeAsync<Component, DeleteEventArgs>(Delete,
EventPhases.TransactionCommitted);
}
Client.Tridion.Events.GuidelinesHandler
constructor. Could you share the empty constructor from that class.