I have Asp.Net MVC2 (.Net 4.0) site. It uses NHibernate 3.0 + Fluent NHibernate. I want to deploy it on remote server.
When I run it locally with connection string of the remote database, everything is ok. When I deploy it and look using browser it开发者_高级运维 works without errors. I also can register new user on the web site (it creates record in membership tables and in additional table). I can see all the user information, that I entered during registration. By this moment everything is ok. Then I try to modify some info in profile but (!!!) after page refreshing I see old data. So, nothing changes in the database. What a... "Hm, INSERT works, but UPDATE not", - I thought. Then I tried to set up logging using Log4Net, but it doesn't creates log file. Nesessary to note, that everything works fine locally. I found this article "Security" problem with NHibernate on deployed web application, but looking in the control panel of the hosting I found "CAS trust level: Full". I am in despair. Post all of your ideas, everything might be useful.So, I've solved it by myself. The problem was in NHibernate. I use opening-session-for-each-request best practice and NHibernate session should be flushed on every HTTP session end. Strage, but it is not. I added session.Flush(); session.Clear();
to my SaveOrUpdate()
and Update()
methods. Now it works correcly.
So, I don't understand such behaviour. Any ideas?
精彩评论