Use the ASP. NET Website Configuration tool without installing SQL Server Express

Source: Internet
Author: User
Tags sql server express

If you have installed the full SQL Server version, the following error occurs when you use the ASP. NET Website Configuration tool:

Failed to establish database connection. If you have not created an SQL Server database, log out of the website management tool, use the aspnet_regsql command line utility to create and configure the database, and then return to the tool to set the provider.

Generally ,. net will ask the program to find the database in the app_data directory of the current website by default, and then open it with SQL Server Express, which is reflected in the default connection string configuration of IIS and machine. config:

Data Source =. \ sqlexpress; Integrated Security = sspi; attachdbfilename = | datadirectory | aspnetdb. MDF; user instance = true

The problem is, of course, you cannot change it directly, because since we use the full database, we must write the user/role/permission information in the current database, it is impossible to create a database separately and store it in app_data,

The solution is also simple. The program searches for the connection string named localsqlserver by default, so we only need. you can overwrite it in the config file. Note that to overwrite it, you must first remove it and then add it. Otherwise, it will report that it has been defined once.

 

<Connectionstrings> <remove name = "localsqlserver"/> <Add name = "localsqlserver" connectionstring = "Data Source = .; initial catalog = databasename; user id = sa; Password = PWD; trusted_connection = true; "providername =" system. data. sqlclient "/> </connectionstrings>
Related Article

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.