Hi all
On my dev web app NHibernate is working just dandy. When I precompile and deploy the site, I get a MappingException when the SessionFactory is created.
Here's some info from the trace:
NHibernate.Cfg.Environment 2010-07-15 09:20:59,577 [7] INFO NHibernate.Cfg.Environment [(null)] - NHibernate 2.1.2.4000 (2.1.2.4000) 0.452436832055471 0.232383 NHibernate.Cfg.Environment 2010-07-15 09:20:59,718 [7] INFO NHibernate.Cfg.Environment [(null)] - Bytecode provider name : lcg 0.522780409241957 0.070344 NHibernate.Cfg.Environment 2010-07-15 09:20:59,734 [7] INFO NHibernate.Cfg.Environment [(null)] - Using reflection optimizer 0.529107470362853 0.006327 NHibernate.Cfg.Configuration 2010-07-15 09:20:59,827 [7] INFO NHibernate.Cfg.Configuration [(null)] - Mapping resource: Kctc.BusinessLayer.Mappings.StoredWill.hbm.xml 0.623336485503046 0.094229 NHibernate.Dialect.Dialect 2010-07-15 09:21:00,109 [7] INFO NHibernate.Dialect.Dialect [(null)] - Using dialect: NHibernate.Dialect.MsSql2008Dialect 0.91570185596214 0.292365 NHibernate.Cfg.Configuration 2010-07-15 09:21:01,390 [7] ERROR NHibernate.Cfg.Configuration [(null)] - Could not compile the mapping document: Kctc.BusinessLayer.Mappings.StoredWill.hbm.xml NHibernate.MappingException: Could not compile the mapping document: Kctc.BusinessLayer.Mappings.StoredWill.hbm.xml ---> System.InvalidOperationException: Unable to generate a temporary class (result=1). error CS2001: Source file 'C:\WINDOWS\TEMP\shp2uoc8.0.cs' could not be found error CS2008: No inputs specified
at System.Xml.Serialization.Compiler.Compile(Assembly parent, String ns, XmlSerializerCompilerParameters xmlParameters, Evidence evidence)
at System.Xml.Serialization.TempAssembly.GenerateAssembly(XmlMapping[] xmlMappings, Type[] types, String defaultNamespace, Evidence evidence, XmlSerializerCompilerParameters parameters, Assembly assembly, Hashtable assemblies)
at System.Xml.Serialization.TempAssembly..ctor(XmlMapping[] xmlMappings, Type[] types, String defaultNamespace, String location, Evidence evidence)
at System.Xml.Serialization.XmlSerializer.GenerateTempAssembly(XmlMapping xmlMapping, Type type, String defaultNamespace)
at System.Xml.Serialization.XmlSerializer..ctor(Type type, String defaultNamespace)
at System.Xml.Serialization.XmlSerializer..ctor(Type type)
at NHibernate.Cfg.XmlHbmBinding.Binder.Deserialize[T](XmlNode node)
at NHibernate.Cfg.XmlHbmBinding.MappingRootBinder.Bind(XmlNode node)
at NHibernate.Cfg.Configuration.AddValidatedDocument(NamedXmlDocument doc)
--- End of inner exception stack trace ---
2.20609881982207 1.290397
Unhandled Execution Error
Could not compile the mapping document: Kctc.BusinessLayer.Mappings.StoredWill.hbm.xml
at NHibernate.Cfg.Configuration.LogAndThrow(Exception exception)
at NHibernate.Cfg.Configuration.AddValidatedDocument(NamedXmlDocument doc)
at NHibernate.Cfg.Configuration.ProcessMappingsQueue()
at NHibernate.Cfg.Configuration.AddDocumentThroughQueue(NamedXmlDocument document)
at NHibernate.Cfg.Configuration.AddXmlReader(XmlReader hbmReader, String name)
at NHibernate.Cfg.Configuration.AddInputStream(Stream xmlInputStream, String name)
at NHibernate.Cfg.Configuration.AddResource(String path, Assembly assembly)
at NHibernate.Cfg.Configuration.AddAssembly(Assembly assembly)
at Kctc.BusinessLayer.NHibernateSessionFactory.get_SessionFactory() in C:\Kctc\Trunk\Kctc.BusinessLayer\NHibernateSessionFactory.cs:line 26
at Kctc.BusinessLayer.NHibernateSessionFactory.OpenSession() in C:\Kctc\Trunk\Kctc.BusinessLayer\NHibernateSessionFactory.cs:line 39
at Developers_Test.ListSquirps(Object sender, EventArgs e)
at System.Web.UI.WebControls.Button.OnClick(EventArgs e)
at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) 2.20665643259129 0.000558
This suggests to me either that the mapping file has an error or could not be found. But if the dev app works fine, how can there be an issue with the mapping file when it is precompiled and deployed?!
Does anyone have any suggestion as to what might be happening here?
Thanks
David