Machename \ ASPnet login failure Solution

Source: Internet
Author: User
Tags connectionstrings

Symptom: Run from Visual Studio. However, if you cannot log on from IIS (or remotely log on), the system prompts "the host name \ ASPnet logon failed and the default database cannot be opened"

Solution:

1. ASP. NET user-managed data is stored in the aspnetdb. MDF file and accessed during login. So attach the database to SQL Server first.

2. Go to the security directory of the database, create a user, and add the ASPNET user

3. Double-click the ASPNET user. In the displayed dialog box, select all the following database role members.

4. Go to the security directory under the instance and double-click the ASPNET user. In the displayed dialog box, the default database is set to aspnetdb.

After completing the preceding steps, you can log on to

Next we will talk about the arrangement of other databases. For example, there is also a database. MDF, And the connectionstring automatically generated by vs cannot be remotely connected.

1. Attach database. MDF to SQL Server and make the following settings (select public and db_datareader as the role)

2. Change connectionstring to the following format and specify the name of the database to be connected in the connection string.

<Connectionstrings>
<Add name = "connectionstring" connectionstring = "Data Source =. \ sqlexpress; Integrated Security = true; database = Database"
Providername = "system. Data. sqlclient"/> <! -- Identical? -->
</Connectionstrings>

This method has one disadvantage, that is, the default database of ASPNET users can only have one, so this method is only suitable for the use of user management for only one website.

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.