How to deploy ASP.NET MVC 4 application using localDB to local IIS on Windows 7?

Solution 1:

I was also suffering from same problem, but there is a solution for it.

Go to the IIS server, and then to the application pool from which your application is running. In the advanced settings of the application pool there is a "Process Model" option, under which there is an "Identity" option. This is by default the application pool identity. Change it to Local System, and you're done.

And Remember to Put App_Data Folder their in WWW folder of IIS server

Solution 2:

Try this,this will solve your problem:

Edit the applicationHost.config file found in %windir%\system32\inetsrv\config\ specifically the ApplicationPools section.

Change the IdentityType to NetworkService to use newly created database.

<add name="ASP.NET v4.0" managedRuntimeVersion="v4.0">
   <processModel identityType="NetworkService" loadUserProfile="true" setProfileEnvironment="true" />
</add>

Solution 3:

Make sure that the application pool uses an identity that has access to the desired instance of the LocalDB.

Then disable ASP.NET Impersonation in Authentication settings of the application. Otherwise, application uses IUSR_MachineName account to access the database.

This setup may not be suitable for production environment but could be sufficient for database and application development.