First, a word about localdb. LocalDB is a file database for SQL Server, similar to SQLite. It has the most functionality of SQL Server and is easy to use. However, deploying LOCALDB to production systems is not recommended. The deployment of this article is an internal micro-system, and the database is only used to do one of the most basic user authentication without doing anything else. Based on this, decide to try LocalDB deployment directly.
Prior to LocalDB not understand, although it is similar to SQLite, but SQLite is a production database, and localdb more like the experience-based. After the system has been basically debugged and verified, the direct trial of Visual Studio is published to the remote Windows SP1 system. Open the site, the site error.
Database Runtime error occurred. Cannot create an automatic instance. See the Windows Application event log for error details.
The search has been described on StackOverflow and MSDN. The main point is that the LOCALDB is incompatible with the full IIS application and needs to be set up according to a patch. I'm not sure if the latest IIS is compatible, at least the IIS version on Windows Serve R2 is incompatible. There is a more detailed description of the using LocalDB with full IIS, part 1:user profile[1]. According to its Part1 setting, the website still does not run up. In Windows 7 SP1 causes IntelliTrace Collection to fail on iis[2] mentions incompatible patch information and how to resolve it.
In a hurry, install SQL Server Express directly on the servers. If LocalDB is not recommended for deployment, prepare to migrate directly to express. In some references, the SQL Server Runtime is also mentioned, which may be the reason why Express is not installed. After installing SQL Server Express, the Web site still does not work properly. When you download Express, you see that there is also a download option for Chs\x64\sqllocaldb.msi. Maybe this program is the runtime of LocalDB. Uninstall SQL Server Express and install SQLLOCALDB. Run the web again, and the error message changes to the following:
// that's probably what it means . the SQL Server process could not be found to start the instance
It seems that localdb also needs to work with SQL Server Express. After installation, start the website again, the error is still.
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or is not accessible. Verify that the instance
An error occurred during instance startup: The SQL Server process could not be started. )
It is mentioned in [note] that you also need to set IIS's application pool information, which was not changed because I ran the program as a trial administrator. Increase the application pool settings as per the [method].
<Addname= "ASP. v4.0"AutoStart= "true"managedruntimeversion= "v4.0"> <ProcessModelIdentitytype= "SpecificUser"UserName= "Administrator"Password="**********"LoadUserProfile= "true"setprofileenvironment= "true" /></Add>
This web app is primarily server-managed, interacting with the operating system (Win32 API), and some APIs require high permissions. Added loaduserprofile= "true" setprofileenvironment= "true" in the above settings, giving the program pool the ability to read User configuration, environment parameters. Restart the application pool and the app runs correctly.
Looking back, if you want to deploy LocalDB to IIS, you can refer to deployment of SQL Express LocalDB on iis[3]. For this practice, it is likely to go through several:
- Environment for Widnows R2
- You need to install SQL Server Express to install SQLLOCALDB.
- You need to configure C:\WINDOWS\SYSTEM32\INETSRV\CONFIG\APPLICATIONHOST.COF to give the application pool the information to read user data, environment data.
Reference:
[1] Using LocalDB with full IIS, part 1:user profiles, https://blogs.msdn.microsoft.com/sqlexpress/2011/12/08/ using-localdb-with-full-iis-part-1-user-profile/
[2] Windows 7 SP1 causes IntelliTrace Collection to fail on IIS, https://support.microsoft.com/zh-cn/kb/2547655
[3] Deployment of SQL Express LocalDB on IIS, https://blogs.msdn.microsoft.com/gaurav/2013/12/21/ deployment-of-sql-express-localdb-on-iis/
[3] A question on Stack overflow, http://stackoverflow.com/questions/26248293/ Sql-network-interfaces-error-50-local-database-runtime-error-occurred-canno
Issues encountered when deploying ASP. NET MVC Web site using LocalDB