Methods for deploying local database LocalDB on IIS

Source: Internet
Author: User

1. The identity of the IIS application pool is set to "Applicationpoolidentify" (more secure)

2. Do not save the database physical file in the physical path of the site, because the IIS application pool is identified as Applicationpoolidentify, and the permissions for the user (application pool name) in the security permissions for the site folder are set to allow only read, for security reasons, Keep this default setting and create a folder in another location to hold the database (for example: D:\LOCALDB\TESTWEBAPP)

3. Right-click the folder where you saved the database files (for example: Testwebapp)----Properties----Security----edit----Add----input name: IIS apppool\ Application pool name----OK----( At this point, only the application pool name will be displayed as the user name in the list of user names----Check Allow permission, modify, read and Execute, List Folder contents, read, write----determine----determine----(complete permission settings on the database folder)

4. Do not use the default instance, create a shared instance yourself, and set the appropriate permissions, the steps are as follows (for example, LocalDB 2012)

4.1 Open cmd, sequentially execute the following three commands in order to create and enable shared instances (SqlLocalDB.exe generally in the "C:\Program Files\Microsoft SQL Server\110\tools\binn" directory)

" InstanceName "  "InstanceName" "shareinstancename "  " InstanceName "

4.2 Open SQL Server managerment Studio using Windows Authentication Connection (LOCALDB) \.\shareinstancename (note that the data source name format of the shared instance is a bit more than the normal instance)

4.3 Select security----logins----Right-------new logins, on the General tab, using the IIS apppool\ application pool name as the logon name, select Windows Authentication, and on the Server Roles tab, tick the Public "and" sysadmin ", and then create a new login in the same way: NT Authority\System

5. Modify the connection string in the Web. config in the project,

Set "Data Source" to "(LocalDb) \.\shareinstancename",

Set "AttachDbFileName" to "D:\LocalDB\TestWebApp\TestWebApp.mdf"

Other precautions:

* If you restart your system, remember to re-enable the DB instance you created

" InstanceName "

Methods for deploying local database LocalDB on IIS

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.