title: "Failed to initialize database."
body: <p><strong>Situation</strong>
  I've set up new IIS 7.5 server under Win2k8. I've moved application from shared hosting to this server.</p>
  
  <p><strong>Problem</strong>
  I get this error: </p>
  
  <pre><code>Failed to initialize database.
  </code></pre>
  
  <p>The trace:</p>
  
  <pre><code>[SystemException: Failed to initialize database.]
     SyneoERPWeb.MvcApplication.SetupDatabase() in C:\Users\a\Desktop\src\branches\1.1\SyneoERPWeb\Global.asax.cs:194
     SyneoERPWeb.MvcApplication.Application_Start() in C:\Users\a\Desktop\src\branches\1.1\SyneoERPWeb\Global.asax.cs:136
  
  [HttpException (0x80004005): Failed to initialize database.]
     System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +9160125
     System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +131
     System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +194
     System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +339
     System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +253
  
  [HttpException (0x80004005): Failed to initialize database.]
     System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9079228
     System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +97
     System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +256
  </code></pre>
  
  <p><strong>What I've googled and tried:</strong></p>
  
  <ol>
  <li>Give full access to IIS_IUSER to Windows\Temp</li>
  <li>Change AppPoll runs as Network Service, Local Service, Local System</li>
  <li>Every ISS setting that may cause (in my opinion) this problem.</li>
  </ol>
  
  <hr>
  
  <p>I've tried the remote SQL Server (IP 212.122l...) - it worked previously with our app</p>
  
  <p>I've tried it also with my newly installed SQL Server on virtual machine in this same sub-network (IP 192.168...).</p>
  
  <p>Both machines are responding to ping, but neither work with the app. I can connect with MSSQL Management Studio to both also.</p>
  
  <p>So my guess is that the problem is local on app server. I think it occurs before the connection request. It's more like lack of some driver in IIS. Is this possible?</p>
  
  <p>I'm using: NHibernate, EntytyFramewok.</p>