You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use PublishSingleFile (docs) and run the published app I get this exception:
---> System.NotSupportedException: CodeBase is not supported on assemblies loaded from a single-file bundle.
at System.Reflection.RuntimeAssembly.get_CodeBase()
at System.Configuration.ClientConfigPaths..ctor(String exePath, Boolean includeUserConfig)
at System.Configuration.ClientConfigPaths.GetPaths(String exePath, Boolean includeUserConfig)
at System.Configuration.ClientConfigurationHost.get_ConfigPaths()
at System.Configuration.ClientConfigurationHost.GetStreamName(String configPath)
at System.Configuration.ClientConfigurationHost.get_IsAppConfigHttp()
at System.Configuration.Internal.DelegatingConfigHost.get_IsAppConfigHttp()
at System.Configuration.ClientConfigurationSystem..ctor()
at System.Configuration.ConfigurationManager.EnsureConfigurationSystem()
--- End of inner exception stack trace ---
at System.Configuration.ConfigurationManager.EnsureConfigurationSystem()
at System.Configuration.ConfigurationManager.PrepareConfigSystem()
at System.Configuration.ConfigurationManager.GetSection(String sectionName)
at System.Configuration.ConfigurationManager.get_AppSettings()
at NHibernate.Cfg.StaticConfigurationManagerProvider.GetLoggerFactoryClassName()
at NHibernate.NHibernateLogger.GetNhibernateLoggerClass()
at NHibernate.NHibernateLogger.LogWrapper..cctor()
--- End of inner exception stack trace ---
at NHibernate.NHibernateLogger.LogWrapper.get_LoggerFactory()
at NHibernate.Cfg.Environment..cctor()
--- End of inner exception stack trace ---
at NHibernate.Cfg.Configuration.Reset()
at NHibernate.Cfg.Configuration..ctor(SettingsFactory settingsFactory)
at NHibernate.Cfg.Configuration..ctor()
at FluentNHibernate.Cfg.Fluently.Configure()
After looking around the methods in the stack trace, I found a solution:
Set ConfigurationProvider.Current = null before you BuildSessionFactory, this will prevent NHibernate from trying to load appsettings. Somewhat confusing because you usually don't use appsettings with Fluent NHibernate.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Use
PublishSingleFile
(docs) and run the published app I get this exception:After looking around the methods in the stack trace, I found a solution:
Set
ConfigurationProvider.Current = null
before youBuildSessionFactory
, this will prevent NHibernate from trying to load appsettings. Somewhat confusing because you usually don't use appsettings with Fluent NHibernate.Beta Was this translation helpful? Give feedback.
All reactions