c# - FluentNHibernate 1.2.0.712 FileIOException that only occurs on subsequent runs of our app -


I'm working for an application, we start the following exception from the NHibernate in Visual Studio 2014 oddly have make. Specific basis:

  The file or assembly could not load FluentNHibernate, version = 1.2.0.712, culture = neutral, PublicKeyToken = 8aa435e3cb308880 'or one of your dependencies. The API call abnormally exited (Exception from HRESULT: 0x800300FA (STG_E_ABNORMALAPIEXIT))  

When we make a change to the server code, which causes the application to re-compile, Works. This is only happening when we first try to run our web project without the reconstruction of the project.

We have made sure that the DLL is being deployed in the bin folder. We have ensured that there are references to FluentNHibernate v1.2.0.712 in the application. We know that this is the case, because the first time is working as expected.

Such a code, where this is happening, looks like this:

  public class datacontex: IDisposable {private stationary ISessionFactory _sessionFactory; Private static bool _startupComplete; Private static object _ locker; Public Zero () {_locker = null; _sessionFactory = null; } Public FixedEsession GetSession () {EnsureStartup (); ESession session = _sessionFactory.OpenSession (); Session.BeginTransaction (); Return session; } Public Fixed Zero EnsureStartup () {If (_startupComplete) Return; Lock (_Locker) {if (! _startupComplete) {bool success = PerformStartup (); _startupComplete = success; }}} Public Stable Bull Performance Startup () {Return InitializeSessionFactory (); } Public static bool InitializeSessionFactory () {{configuration configuration = build configuration (try); _sessionFactory = configuration.BuildSessionFactory (); Back true; } Catch (Exceptional Pre) {Return String. ISNL Llight (ex. Message); }} Public Static Configuration BuildConfiguration () {Configuration Configuration = Fluently.Configure (New Configuration () Configure ().) // Mapping uses the reflection to add mapping to the assembly (cfg = & gt; cfg. FluentMappings.AddFromAssembly (Typcode (Datacontext). Assembly). Build Configuration (); Return configuration; } Class IncludeCastleDllInBuild: NHibernate.ByteCode.Castle.ProxyFactory {// note: Castle DLL}} with DLL Issues Disappears  

We first detected the cause of this ISession In the assignment GetSession is a null reference exception, through our code drilling deeply and at F11 / F10, we found that they were try / catch InitializeSessionFactory was swallowing errors

Question:

Strong> Why NHibernate failed to load, take Following only runs after our application? More importantly, how do we get rid of this troubled exception

Edit 1: per @DaveZych, I cleared out that for a IDisposable implementation class < Code> _locker added and _sessionFactory field, but there was no effect on its problem. In addition, our in web.config files, we are based on impersonation of a line, and, impersonation is off by default

Edit 2:. For the Spend and Giggles, I added the following code to system.web section in web.config :

  & lt; Authentication mode = "Windows" /> & Lt; Identification impersonation = "false" />  

Unfortunately, despite this, it had no effect. It should also be noted that I am using the latest version of Visual Studio 2013.


Comments

Popular posts from this blog

winforms - C# Form - Property Change -

javascript - amcharts makechart not working -

java - Algorithm negotiation fail SSH in Jenkins -