Castle Windsor & NHibernate facility: Value cannot be null. Parameter name: classType - fluent-nhibernate

Hi I am attempting to use Castle windsor Nhibernate Facility with fluent Nhibernate and Im getting the error above, as far as Im aware , I have followed the instructions on setting this up. Has anyone else seen this issue and maybe offer some advice? Thanks
Value cannot be null.
Parameter name: classType
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentNullException: Value cannot be null.
Parameter name: classType
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[ArgumentNullException: Value cannot be null.
Parameter name: classType]
Castle.MicroKernel.DefaultKernel.AddComponent(String key, Type serviceType, Type classType, LifestyleType lifestyle, Boolean overwriteLifestyle) +191
Castle.MicroKernel.DefaultKernel.AddComponent(String key, Type serviceType, Type classType, LifestyleType lifestyle) +48
Castle.MicroKernel.DefaultKernel.AddComponent(String key, Type serviceType, Type classType) +45
Castle.Facilities.NHibernateIntegration.NHibernateFacility.RegisterDefaultConfigurationBuilder() +154
Castle.Facilities.NHibernateIntegration.NHibernateFacility.RegisterComponents() +29
Castle.Facilities.NHibernateIntegration.NHibernateFacility.Init() +196
Castle.MicroKernel.Facilities.AbstractFacility.Init(IKernel kernel, IConfiguration facilityConfig) +61
Castle.MicroKernel.DefaultKernel.AddFacility(String key, IFacility facility) +182
Castle.Windsor.WindsorContainer.AddFacility(String key, IFacility facility) +49
Castle.Windsor.Installer.DefaultComponentInstaller.SetUpFacilities(IConfiguration[] configurations, IWindsorContainer container) +242
Castle.Windsor.Installer.DefaultComponentInstaller.SetUp(IWindsorContainer container, IConfigurationStore store) +89
Castle.Windsor.WindsorContainer.RunInstaller() +76
Castle.Windsor.WindsorContainer..ctor(IConfigurationInterpreter interpreter) +144
KingMaker.Web.Windsor.ContainerBuilder.Build(String config) +90
KingMaker.Web.MvcApplication.InitializeWindsor() +74
KingMaker.Web.MvcApplication.Application_Start() +55
Here is the facility xml facility
<facility
id="nhibernatefacility"
type="Castle.Facilities.NHibernateIntegration.NHibernateFacility, Castle.Facilities.NHibernateIntegration"
isWeb="true"
configurationBuilder="App.Web.Maps.FluentNHibernateConfigurationBuilder, App.Web">
<!-- configuration here is overriden by the FluentNHibernateConfigurationBuilder -->
<factory id="sessionFactory1">
<settings>
<item key="connection.provider">NHibernate.Connection.DriverConnectionProvider</item>
<item key="connection.driver_class">NHibernate.Driver.SqlClientDriver</item>
<item key="connection.connection_string">Data Source=localhost\sqlexpress;Initial Catalog=FIDPortal;Integrated Security=SSPI</item>
<item key="dialect">NHibernate.Dialect.MsSql2005Dialect</item>
<item key="proxyfactory.factory_class">NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle</item>
</settings>
<!-- <assemblies>-->
<!-- <assembly>Castle.Facilities.NHibernateIntegration.Tests</assembly>-->
<!-- </assemblies>-->
</factory>
</facility>

The stack trace says the type defined in the configurationBuilder attribute (FluentNHibernateConfigurationBuilder) is invalid or not found. Double-check the namespace and assembly name.

Related

Value cannot be null exception when trying to run Imageresizer

I get the following error when trying to run my Image Resizer using my rest api plugin with this urL: http://localhost:8001/D1900010012059
Plugin code can be found here: https://github.com/mikaelekstrom/resizerapiplugin/blob/master/RestAPIImageRetriever.cs
Value cannot be null.
Parameter name: value
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentNullException: Value cannot be null.
Parameter name: value
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[ArgumentNullException: Value cannot be null.
Parameter name: value]
System.String.StartsWith(String value, StringComparison comparisonType) +598
ImageResizer.Storage.BlobProviderBase.FileExists(String virtualPath, NameValueCollection queryString) +88
ImageResizer.Plugins.VirtualPathProviderShim.GetVIP(String virtualPath) +217
ImageResizer.Plugins.VirtualPathProviderShim.FileExists(String virtualPath) +23
System.Web.Routing.RouteCollection.IsRouteToExistingFile(HttpContextBase httpContext) +120
System.Web.Routing.RouteCollection.GetRouteData(HttpContextBase httpContext) +129
System.Web.Routing.UrlRoutingModule.PostResolveRequestCache(HttpContextBase context) +70
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +139
System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +195
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +88
You need to set the VirtualFilesystemPrefix property on the base class to set up routing for your class. You class will handle all requests going to that prefix.

SID of the target principal could not be resolved.

I delpoyed my web application (which uses LDAP) on windows server 2016. It is throwing below error. Though I am able to access same ADLDS instance using ADSI or C# console application (created utility to test connectivity). But not sure why its throwing error with web application. Please suggest.
Server Error in '/' Application.
**While trying to resolve a cross-store reference, the SID of the target principal could not be resolved. The error code is 1722.**
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.DirectoryServices.AccountManagement.PrincipalOperationException: While trying to resolve a cross-store reference, the SID of the target principal could not be resolved. The error code is 1722.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[PrincipalOperationException: While trying to resolve a cross-store reference, the SID of the target principal could not be resolved. The error code is 1722.]
System.DirectoryServices.AccountManagement.ADStoreCtx.ResolveCrossStoreRefToPrincipal(Object o) +570
System.DirectoryServices.AccountManagement.ADUtils.DirectoryEntryAsPrincipal(DirectoryEntry de, ADStoreCtx storeCtx) +133
System.DirectoryServices.AccountManagement.ADDNLinkedAttrSet.get_CurrentAsPrincipal() +86
System.DirectoryServices.AccountManagement.PrincipalCollectionEnumerator.MoveNext() +252
System.DirectoryServices.AccountManagement.PrincipalCollectionEnumerator.System.Collections.IEnumerator.MoveNext() +9
System.Linq.<SelectManyIterator>d__22`3.MoveNext() +65
System.Linq.Lookup`2.Create(IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer) +264
System.Linq.GroupedEnumerable`3.GetEnumerator() +72
System.Linq.WhereSelectEnumerableIterator`2.MoveNext() +63
System.Collections.Generic.List`1.InsertRange(Int32 index, IEnumerable`1 collection) +392
System.Collections.Generic.List`1.AddRange(IEnumerable`1 collection) +15
Plastin.Common.Security.ADLDSClaimsProvider.SetApplicationClaims() +1012
Plastin.Common.Security.ADLDSClaimsProvider.Initialise() +174
Plastin.Common.Security.ADLDSClaimsProvider..cctor() +238
[TypeInitializationException: The type initializer for 'Plastin.Common.Security.ADLDSClaimsProvider' threw an exception.]
lambda_method(Closure , IBuilderContext ) +81
Microsoft.Practices.ObjectBuilder2.<>c__DisplayClass1.<GetBuildMethod>b__0(IBuilderContext context) +35
Microsoft.Practices.ObjectBuilder2.DynamicMethodBuildPlan.BuildUp(IBuilderContext context) +10
Microsoft.Practices.ObjectBuilder2.BuildPlanStrategy.PreBuildUp(IBuilderContext context) +198
Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(IBuilderContext context) +209
Microsoft.Practices.Unity.UnityContainer.DoBuildUp(Type t, Object existing, String name, IEnumerable`1 resolverOverrides) +165
[ResolutionFailedException: Resolution of the dependency failed, type = "Plastin.Common.Security.IClaimsProvider", name = "(none)".
Exception occurred while: Calling constructor Plastin.Common.Security.ADLDSClaimsProvider().
Exception is: TypeInitializationException - The type initializer for 'Plastin.Common.Security.ADLDSClaimsProvider' threw an exception.
-----------------------------------------------
At the time of the exception, the container was:
Resolving Plastin.Common.Security.ADLDSClaimsProvider,(none) (mapped from Plastin.Common.Security.IClaimsProvider, (none))
Calling constructor Plastin.Common.Security.ADLDSClaimsProvider()
]
Microsoft.Practices.Unity.UnityContainer.DoBuildUp(Type t, Object existing, String name, IEnumerable`1 resolverOverrides) +329
Microsoft.Practices.Unity.UnityContainer.Resolve(Type t, String name, ResolverOverride[] resolverOverrides) +15
Microsoft.Practices.Unity.UnityContainerExtensions.Resolve(IUnityContainer container, ResolverOverride[] overrides) +72
Plastin.Common.Security.AuthenticationManager.Authenticate(String resourceName, ClaimsPrincipal incomingPrincipal) +149
Plastin.Portal.MvcApplication.Application_PostAuthenticateRequest() +70
[TargetInvocationException: Exception has been thrown by the target of an invocation.]
System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) +0
System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) +87
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +101
System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters) +21
System.Web.Util.ArglessEventHandlerProxy.Callback(Object sender, EventArgs e) +56
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +141
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +69
Finally we fixed this issue and my apologies I am getting late to answer this question. After lots of debugging we identified that our web application was throwing this error while getting members of ADLDS group. It was unusual as same application was working on other server. So we decided to captured network traffic using Wireshark. Wireshark capture indicated that connectivity between LDAP server and application server was blocked over SMB port 445. So we get our Network team to open port 445 which fixed the issue.
This error seems very generic error and could be other reasons for this error in your scenario but using network traffic capturing tool (like wireshark) at early stage of investigation might help you to troubleshoot these kind of issue quickly.

OData WCF service suddenly starts to return 404 on .Net 4.0

We have an OData WCF service running on some customers servers. Everything worked very well on .Net 3.5, but after having upgraded our solution to .Net4, the WCF service suddenly starts returning 404 for all requests after random time intervals, usually several days.
The rest of the web site is running normally. The 404's appear to be happening after the website has restarted.
In order to make it work again, we have make a change in web.config. Calling HttpRuntime.UnloadAppDomain(); fails to fix the problem.
We're trying to reproduce the error locally, but since it sometimes takes several days before it happens, it's a difficult problem to reproduce.
Any suggestions?
EDIT:
This is the error message from the server event log:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
<Provider Name="System.ServiceModel 4.0.0.0" />
<EventID Qualifiers="49154">3</EventID>
<Level>2</Level>
<Task>5</Task>
<Keywords>0x80000000000000</Keywords>
<TimeCreated SystemTime="2012-06-02T11:15:32.000000000Z" />
<EventRecordID>28236</EventRecordID>
<Channel>Application</Channel>
<Computer>xxxx-ST-001</Computer>
<Security UserID="S-1-5-82-3945269471-185734930-3707521103-2442450153-1755958218" />
</System>
- <EventData>
<Data>System.ServiceModel.Activation.HostedHttpRequestAsyncResult/65092316</Data>
<Data>System.Web.HttpException (0x80004005): There was no channel actively listening at 'http://11.11.11.11/waf/services/OData.svc'. This is often caused by an incorrect address URI. Ensure that the address to which the message is sent matches an address on which a service is listening. ---> System.ServiceModel.EndpointNotFoundException: There was no channel actively listening at 'http://11.11.11.11/waf/Services/OData.svc'. This is often caused by an incorrect address URI. Ensure that the address to which the message is sent matches an address on which a service is listening. at System.ServiceModel.Activation.HostedHttpTransportManager.HttpContextReceived(HostedHttpRequestAsyncResult result) at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.HandleRequest() at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.BeginRequest() at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result) at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result)</Data>
<Data>w3wp</Data>
<Data>1852</Data>
</EventData>
Update 18.december 2012:
We're able to reproduce the error locally by making sure the first request to the site after a restart is made to the WCF OData service. The error message:
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an object.]
System.Web.Compilation.DiskBuildResultCache.CacheBuildResult(String cacheKey, BuildResult result, Int64 hashCode, DateTime utcStart) +9508708
System.Web.Compilation.BuildManager.CacheBuildResultInternal(String cacheKey, BuildResult result, Int64 hashCode, DateTime utcStart) +70
System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath) +9929866
System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate) +299
System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate) +103
System.Web.Compilation.BuildManager.GetVPathBuildResult(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean ensureIsUpToDate) +82
System.Web.Compilation.BuildManager.GetCompiledCustomString(String virtualPath) +29
System.ServiceModel.HostingManager.GetCompiledCustomString(String normalizedVirtualPath) +164
System.ServiceModel.HostingManager.CreateService(String normalizedVirtualPath, EventTraceActivity eventTraceActivity) +206
System.ServiceModel.HostingManager.ActivateService(ServiceActivationInfo serviceActivationInfo, EventTraceActivity eventTraceActivity) +52
System.ServiceModel.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath, EventTraceActivity eventTraceActivity) +598
[ServiceActivationException: The service '/ecoodata' cannot be activated due to an exception during compilation. The exception message is: Object reference not set to an instance of an object..]
System.Runtime.AsyncResult.End(IAsyncResult result) +495736
System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result) +178
System.ServiceModel.Activation.ServiceHttpModule.EndProcessRequest(IAsyncResult ar) +348782
System.Web.AsyncEventExecutionStep.OnAsyncEventCompletion(IAsyncResult ar) +9663393
Anyone got a clue what this might be?

Can't Able to get Instance of ExceptionManager

I am using Enterprise Library 5.0 in Silverlight using mvvm-light Framework.
When I'm going to getInstace of ExceptionManager Class like:
var exceptionManager = EnterpriseLibraryContainer.Current.GetInstance<ExceptionManager>();
exceptionManager.HandleException(E.Error, "Policy");
I Got this type of error Message
Activation error occured while trying to get instance of type ExceptionManager, key ""
Resolution of the dependency failed, type = Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.ExceptionManager", name = "(none)"
Exception occurred while: while resolving.Exception is: InvalidOperationException - The type TraceListener cannot be constructed. You must configure the container to supply this value
-----------------------------------------------
At the time of the exception, the container was:
Resolving Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.ExceptionManagerImpl,ExceptionManager.__default__ (mapped from Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.ExceptionManager, (none))
Resolving parameter "exceptionPolicies" of constructor Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.ExceptionManagerImpl(System.Collections.Generic.IEnumerable`1[[Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.ExceptionPolicyImpl, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Silverlight, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]] exceptionPolicies, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Instrumentation.IDefaultExceptionHandlingInstrumentationProvider instrumentationProvider)
Resolving Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.ExceptionPolicyImpl,Policy
Resolving parameter "policyEntries" of constructor Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.ExceptionPolicyImpl(System.String policyName, System.Collections.Generic.IEnumerable`1[[Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.ExceptionPolicyEntry, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Silverlight, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]] policyEntries)
Resolving Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.ExceptionPolicyEntry,Policy.All Exceptions
Resolving parameter "handlers" of constructor Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.ExceptionPolicyEntry(System.Type exceptionType, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.PostHandlingAction postHandlingAction, System.Collections.Generic.IEnumerable`1[[Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.IExceptionHandler, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Silverlight, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]] handlers, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Instrumentation.IExceptionHandlingInstrumentationProvider instrumentationProvider)
Resolving Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging.LoggingExceptionHandler,Policy.All Exceptions.Logging Exception Handler (mapped from Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.IExceptionHandler, Policy.All Exceptions.Logging Exception Handler)
Resolving parameter "writer" of constructor Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging.LoggingExceptionHandler(System.String logCategory, System.Int32 eventId, Microsoft.Practices.EnterpriseLibrary.Logging.Diagnostics.TraceEventType severity, System.String title, System.Int32 priority, System.Type formatterType, Microsoft.Practices.EnterpriseLibrary.Logging.LogWriter writer)
Resolving Microsoft.Practices.EnterpriseLibrary.Logging.LogWriterImpl,LogWriter.__default__ (mapped from Microsoft.Practices.EnterpriseLibrary.Logging.LogWriter, (none))
Resolving parameter "structureHolder" of constructor Microsoft.Practices.EnterpriseLibrary.Logging.LogWriterImpl(Microsoft.Practices.EnterpriseLibrary.Logging.LogWriterStructureHolder structureHolder, Microsoft.Practices.EnterpriseLibrary.Logging.Instrumentation.ILoggingInstrumentationProvider instrumentationProvider, Microsoft.Practices.EnterpriseLibrary.Logging.IAsyncTracingErrorReporter asyncTracingErrorReporter)
Resolving Microsoft.Practices.EnterpriseLibrary.Logging.LogWriterStructureHolder,LogWriterStructureHolder.__default__ (mapped from Microsoft.Practices.EnterpriseLibrary.Logging.LogWriterStructureHolder, (none))
Resolving parameter "traceSources" of constructor Microsoft.Practices.EnterpriseLibrary.Logging.LogWriterStructureHolder(System.Collections.Generic.IEnumerable`1[[Microsoft.Practices.EnterpriseLibrary.Logging.Filters.ILogFilter, Microsoft.Practices.EnterpriseLibrary.Logging.Silverlight, Version=5.0.505.1, Culture=neutral, PublicKeyToken=31bf3856ad364e35]] filters, System.Collections.Generic.IEnumerable`1[[System.String, mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]] traceSourceNames, System.Collections.Generic.IEnumerable`1[[Microsoft.Practices.EnterpriseLibrary.Logging.LogSource, Microsoft.Practices.EnterpriseLibrary.Logging.Silverlight, Version=5.0.505.1, Culture=neutral, PublicKeyToken=31bf3856ad364e35]] traceSources, Microsoft.Practices.EnterpriseLibrary.Logging.LogSource allEventsTraceSource, Microsoft.Practices.EnterpriseLibrary.Logging.LogSource notProcessedTraceSource, Microsoft.Practices.EnterpriseLibrary.Logging.LogSource errorsTraceSource, System.String defaultCategory, System.Boolean tracingEnabled, System.Boolean logWarningsWhenNoCategoriesMatch, System.Boolean revertImpersonation)
Resolving Microsoft.Practices.EnterpriseLibrary.Logging.LogSource,General
Resolving parameter "traceListeners" of constructor Microsoft.Practices.EnterpriseLibrary.Logging.LogSource(System.String name, System.Collections.Generic.IEnumerable`1[[Microsoft.Practices.EnterpriseLibrary.Logging.Diagnostics.TraceListener, Microsoft.Practices.EnterpriseLibrary.Logging.Silverlight, Version=5.0.505.1, Culture=neutral, PublicKeyToken=31bf3856ad364e35]] traceListeners, Microsoft.Practices.EnterpriseLibrary.Logging.Diagnostics.SourceLevels level, System.Boolean autoFlush, Microsoft.Practices.EnterpriseLibrary.Logging.Instrumentation.ILoggingInstrumentationProvider instrumentationProvider)
Resolving Microsoft.Practices.EnterpriseLibrary.Logging.Diagnostics.TraceListener,Flat File Trace Listener
At Line of
var exceptionManager = EnterpriseLibraryContainer.Current.GetInstance<ExceptionManager>();
My Configuration File is:
<?xml version="1.0" encoding="utf-8"?>
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:el="http://schemas.microsoft.com/practices/2011/entlib">
<el:ExceptionHandlingSettings x:Key="exceptionHandling">
<el:ExceptionHandlingSettings.ExceptionPolicies>
<el:ExceptionPolicyData Name="LogPolicy">
<el:ExceptionPolicyData.ExceptionTypes>
<el:ExceptionTypeData Name="All Exceptions" TypeName="System.Exception, mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e">
<el:ExceptionTypeData.ExceptionHandlers>
<el:LoggingExceptionHandlerData LogCategory="General" FormatterTypeName="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.TextExceptionFormatter, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Silverlight, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Priority="-1" Name="Logging Exception Handler" />
</el:ExceptionTypeData.ExceptionHandlers>
</el:ExceptionTypeData>
</el:ExceptionPolicyData.ExceptionTypes>
</el:ExceptionPolicyData>
</el:ExceptionHandlingSettings.ExceptionPolicies>
</el:ExceptionHandlingSettings>
<el:LoggingSettings DefaultCategory="General" x:Key="loggingConfiguration">
<el:LoggingSettings.TraceSources>
<el:TraceSourceData Name="General">
<el:TraceSourceData.TraceListeners>
<el:TraceListenerReferenceData Name="Flat File Trace Listener" />
</el:TraceSourceData.TraceListeners>
</el:TraceSourceData>
</el:LoggingSettings.TraceSources>
<el:LoggingSettings.SpecialTraceSources>
<el:SpecialTraceSourcesData>
<el:SpecialTraceSourcesData.AllEventsTraceSource>
<el:TraceSourceData Name="All Events" />
</el:SpecialTraceSourcesData.AllEventsTraceSource>
<el:SpecialTraceSourcesData.NotProcessedTraceSource>
<el:TraceSourceData Name="Unprocessed Category" />
</el:SpecialTraceSourcesData.NotProcessedTraceSource>
<el:SpecialTraceSourcesData.ErrorsTraceSource>
<el:TraceSourceData Name="Logging Errors & Warnings">
<el:TraceSourceData.TraceListeners>
<el:TraceListenerReferenceData Name="Flat File Trace Listener" />
</el:TraceSourceData.TraceListeners>
</el:TraceSourceData>
</el:SpecialTraceSourcesData.ErrorsTraceSource>
</el:SpecialTraceSourcesData>
</el:LoggingSettings.SpecialTraceSources>
</el:LoggingSettings>
</ResourceDictionary>
It looks like your configuration is referencing a trace listener called "Flat File Trace Listener" but there is no trace listener defined by that name.
Also, you should be aware that the Enterprise Library Silverlight Logging Application Block does not support a Flat File Trace Listener. Valid actions are:
Logging to a remote WCF Service.
Logging to isolated storage.
Logging to an event.

Error while creating Fluent NHibernate Session factory

Does anyone have any experience with the following fluent config error?
faultString = "An invalid or incomplete configuration was used while creating a SessionFactory. Check PotentialReasons collection, and InnerException for more detail.
I have no problems on my development box, but when the dlls are put up on the production server and tested, the error occurs.
The development box is pointing at the same database so I don't think differences in schema are the issue.
Also, does any one know if there is any documentation for fluent nhibernate?
Any pointers much appreciated.
Here is the inner exception thrown:
System.TypeInitializationException: The type initializer for 'NHibernate.ByteCode.Castle.ProxyFactory' threw an exception. ---> System.Security.SecurityException: That assembly does not allow partially trusted callers.
at Castle.DynamicProxy.ModuleScope..ctor(Boolean savePhysicalAssembly, String strongAssemblyName, String strongModulePath, String weakAssemblyName, String weakModulePath)
at Castle.DynamicProxy.ModuleScope..ctor(Boolean savePhysicalAssembly)
at Castle.DynamicProxy.ProxyGenerator..ctor()
at NHibernate.ByteCode.Castle.ProxyFactory..cctor()
The action that failed was:
LinkDemand
The Zone of the assembly that failed was:
MyComputer
--- End of inner exception stack trace ---
at NHibernate.ByteCode.Castle.ProxyFactory..ctor()
at NHibernate.ByteCode.Castle.ProxyFactoryFactory.BuildProxyFactory()
at NHibernate.Tuple.Entity.PocoEntityTuplizer.BuildProxyFactoryInternal(PersistentClass class, IGetter getter, ISetter setter)
at NHibernate.Tuple.Entity.PocoEntityTuplizer.BuildProxyFactory(PersistentClass persistentClass, IGetter idGetter, ISetter idSetter)
at NHibernate.Tuple.Entity.AbstractEntityTuplizer..ctor(EntityMetamodel entityMetamodel, PersistentClass mappingInfo)
at NHibernate.Tuple.Entity.PocoEntityTuplizer..ctor(EntityMetamodel entityMetamodel, PersistentClass mappedEntity)
at NHibernate.Tuple.Entity.EntityEntityModeToTuplizerMapping..ctor(PersistentClass mappedEntity, EntityMetamodel em)
at NHibernate.Tuple.Entity.EntityMetamodel..ctor(PersistentClass persistentClass, ISessionFactoryImplementor sessionFactory)
at NHibernate.Persister.Entity.AbstractEntityPersister..ctor(PersistentClass persistentClass, ICacheConcurrencyStrategy cache, ISessionFactoryImplementor factory)
at NHibernate.Persister.Entity.SingleTableEntityPersister..ctor(PersistentClass persistentClass, ICacheConcurrencyStrategy cache, ISessionFactoryImplementor factory, IMapping mapping)
at NHibernate.Persister.PersisterFactory.CreateClassPersister(PersistentClass model, ICacheConcurrencyStrategy cache, ISessionFactoryImplementor factory, IMapping cfg)
at NHibernate.Impl.SessionFactoryImpl..ctor(Configuration cfg, IMapping mapping, Settings settings, EventListeners listeners)
at NHibernate.Cfg.Configuration.BuildSessionFactory()
at FluentNHibernate.Cfg.FluentConfiguration.BuildSessionFactory() in d:\Builds\FluentNH\src\FluentNHibernate\Cfg\FluentConfiguration.cs:line 93"
message = "faultCode:Server.Processing faultString:'System.TypeInitializationException: The type initializer for 'NHibernate.ByteCode.Castle.ProxyFactory' threw an exception. ---> System.Security.SecurityException: That assembly does not allow partially trusted callers.
at Castle.DynamicProxy.ModuleScope..ctor(Boolean savePhysicalAssembly, String strongAssemblyName, String strongModulePath, String weakAssemblyName, String weakModulePath)
at Castle.DynamicProxy.ModuleScope..ctor(Boolean savePhysicalAssembly)
at Castle.DynamicProxy.ProxyGenerator..ctor()
at NHibernate.ByteCode.Castle.ProxyFactory..cctor()
The action that failed was:
LinkDemand
The Zone of the assembly that failed was:
MyComputer
--- End of inner exception stack trace ---
at NHibernate.ByteCode.Castle.ProxyFactory..ctor()
at NHibernate.ByteCode.Castle.ProxyFactoryFactory.BuildProxyFactory()
at NHibernate.Tuple.Entity.PocoEntityTuplizer.BuildProxyFactoryInternal(PersistentClass class, IGetter getter, ISetter setter)
at NHibernate.Tuple.Entity.PocoEntityTuplizer.BuildProxyFactory(PersistentClass persistentClass, IGetter idGetter, ISetter idSetter)
at NHibernate.Tuple.Entity.AbstractEntityTuplizer..ctor(EntityMetamodel entityMetamodel, PersistentClass mappingInfo)
at NHibernate.Tuple.Entity.PocoEntityTuplizer..ctor(EntityMetamodel entityMetamodel, PersistentClass mappedEntity)
at NHibernate.Tuple.Entity.EntityEntityModeToTuplizerMapping..ctor(PersistentClass mappedEntity, EntityMetamodel em)
at NHibernate.Tuple.Entity.EntityMetamodel..ctor(PersistentClass persistentClass, ISessionFactoryImplementor sessionFactory)
at NHibernate.Persister.Entity.AbstractEntityPersister..ctor(PersistentClass persistentClass, ICacheConcurrencyStrategy cache, ISessionFactoryImplementor factory)
at NHibernate.Persister.Entity.SingleTableEntityPersister..ctor(PersistentClass persistentClass, ICacheConcurrencyStrategy cache, ISessionFactoryImplementor factory, IMapping mapping)
at NHibernate.Persister.PersisterFactory.CreateClassPersister(PersistentClass model, ICacheConcurrencyStrategy cache, ISessionFactoryImplementor factory, IMapping cfg)
at NHibernate.Impl.SessionFactoryImpl..ctor(Configuration cfg, IMapping mapping, Settings settings, EventListeners listeners)
at NHibernate.Cfg.Configuration.BuildSessionFactory()
at FluentNHibernate.Cfg.FluentConfiguration.BuildSessionFactory() in d:\Builds\FluentNH\src\FluentNHibernate\Cfg\FluentConfiguration.cs:line 93' faultDetail:'null'"
name = "Error"
rootCause = (null)
FluorineStackTrace:
undefined
I think this is close to this question about trust:
NHibernate 2 + Fluent Nhibernate medium trust
The issue isn't about fluent NHibernate, but Castle Dynamic Proxy 2. I personally have full trust on the environments I deploy to so I haven't had to resolve it.
Your options are to:
Get an updated Castle Dynamic Proxy so that this is fixed.
Try another proxy.
Use the pregenerated nhibernate proxy factory.
You should be able to find posts for all of these on nhforge.org
See the answer to this question:
assembly does not allow partially trusted callers
Your development machine is likely running full trust, while your production machine is likely running medium trust.