Dear forum users,
i have an (for me) unresolvable problem with my application when trying to bring it up and running while porting from VS.NET2003 to VS.NET2005.
With VS.NET2003 everything is working fine - i have to say, i'm new to NHibernate but i got NHibernate up and running within 20 minutes on the old VS.NET2003 (i tried the Quickstart guide on this webpage) and my MSSQL database.
Now, VS.NET2005 arrived and nothing works - it seems there are some problems with the config.
I tried to copy the config from the old VS.NET2003 project, but now i have several different exceptions beeing thrown, when trying to build the sessionFactory. I have checked the PDF-quickstart guide ("NHibernate & IIS - playin with cats"), i have viewed the articles at theserverside.net, i read the tutorials codeproject.com, but i can't find the info to have it working :-(
The config i tried is:
Code:
<hibernateSettings>
<session-factory>
<add key="dialect"
value="NHibernate.Dialect.MsSql2000Dialect"
/>
<add key="connection.provider"
value="NHibernate.Connection.DriverConnectionProvider"
/>
<add key="connection.connection_string"
value="Server=XXXX;initial catalog=XXXX;uid=XXXX;pwd=XXXX"
/>
<mapping assembly="SITApp" />
</session-factory>
</hibernateSettings>
the funny exception i recieve is:
Quote:
{"problem parsing configuration : System.IO.FileNotFoundException: Could not find file 'c:\\inetpub\\wwwroot\\sitapp\\bin\\hibernate.cfg.xml'.\r\nFile name: 'c:\\inetpub\\wwwroot\\sitapp\\bin\\hibernate.cfg.xml'\r\n at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)\r\n at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)\r\n at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize)\r\n at System.Xml.XmlDownloadManager.GetStream(Uri uri, ICredentials credentials)\r\n at System.Xml.XmlUrlResolver.GetEntity(Uri absoluteUri, String role, Type ofObjectToReturn)\r\n at System.Xml.XmlTextReaderImpl.OpenUrlDelegate(Object xmlResolver)\r\n at System.Threading.CompressedStack.runTryCode(Object userData)\r\n at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)\r\n at System.Threading.CompressedStack.Run(CompressedStack compressedStack, ContextCallback callback, Object state)\r\n at System.Xml.XmlTextReaderImpl.OpenUrl()\r\n at System.Xml.XmlTextReaderImpl.Read()\r\n at System.Xml.XmlTextReader.Read()\r\n at System.Xml.XmlValidatingReaderImpl.Read()\r\n at System.Xml.XmlValidatingReader.Read()\r\n at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace)\r\n at System.Xml.XmlDocument.Load(XmlReader reader)\r\n at NHibernate.Cfg.Configuration.Configure(XmlTextReader reader)"}
i don't understand why it's searching for an hibernate.cfg.xml file when i've placed all that stuff in the web.config file.
then, there was another problem when i tried to have a tag starting like:
Code:
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.0">
then i recieve:
Quote:
"Unrecognized attribute 'xmlns'. Note that attribute names are case-sensitive...."
next, i tried to cut out the "xmlns" tag; after that, i recieved:
Quote:
"Unrecognized element."
another issue is:
in VS.NET2003 i have the option to say buildaction -> "embedded resource" for all the hmb.xml mapping files - this option is unavailable for me in VS.NET2005 - it's not there, really ! I don't know why...
please understand:
everything is working fine with VS.NET2003 - but i'm completely unable to get it up and running on VS.NET2005. As said before, i'm fairly new to NHibernate and database programming - before that i acted in standard application development, tools for games and such stuff... but sorry: i don't understand why this stuff won't work on VS.NET2005.
please help !
*****EDIT******
now, what i tried last was, i copied the _original_ config file from the quickstart guide, which looks like:
Code:
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.0">
<session-factory>
<property name="dialect">NHibernate.Dialect.MsSql2000Dialect</property>
<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
<property name="connection.connection_string">Server=XXXX;initial catalog=XXXX;uid=XXXX;pwd=XXXX</property>
<mapping assembly="SITApp" />
</session-factory>
</hibernate-configuration>
and everything what i recieve, is, the above already mentioned:
Quote:
{"Unrecognized attribute 'xmlns'. Note that attribute names are case-sensitive. (c:\\inetpub\\wwwroot\\sitapp\\web.config line 23)"}
HELL, please help me !
are the quickstart guide examples VS.NET2003 specific ?
i don't understand why it says: "xmlns unrecognized" if i can see that the build-in XML editor is proposing the tag "xmlns" when i start typing - all that stuff worked *perfectly* with the old VS.NET2003 application....
****EDIT NR.2****
i tried both NHibernate versions:
1.0.2 and the latest alpha.
no difference - i get the same error...
****EDIT NR.3****
for some reason, i get different exceptions when switching the name of the hibernate-config block, from:
Code:
<hibernate-configuration>
to (example):
Code:
<hibernate>
in the first case, it says ""Unrecognized element."; in the second case it says the above mentioned exception with the looonnnggg text ("unable to parse config...").
SORRY, i don't understand why it throws different exceptions depending on THE NAME i have chosen for the name of the config block ??????