ASP.NET Web管理工具; asp.net连接字符串

时间:2014-01-31 16:12:27

标签: asp.net .net

我的本​​地计算机上的ASP.NET webapplication和服务器上的SQL Server数据库。我在服务器上运行aspnet_regsql.exe。之后我从ASP.NET管理工具创建了管理员角色。还创建了一个具有管理员权限的用户在sql server的安全部分下,提供用户db_owner访问权限。现在,当我试图运行我的应用程序时,我得到以下错误,

Server Error in '/UBCAT' Application.

Login failed for user 'admin'.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.Data.SqlClient.SqlException: Login failed for user 'admin'.

Source Error: 


Line 36: 
Line 37:         context.Logins.AddObject(login);
Line 38:         context.SaveChanges();
Line 39:     }
Line 40:   

//连接字符串:

            

<customErrors mode="Off"></customErrors>

<authentication mode="Forms">
  <forms name="UBCATSqlAuthCookie" loginUrl="~/Account/Login.aspx"
    timeout="60" />
</authentication>
<sessionState timeout="60" />
<membership defaultProvider="UBCATSqlMembershipProvider" userIsOnlineTimeWindow="60">
  <providers>
    <clear />
    <add name="UBCATSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="UBCATDB" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" applicationName="UBCAT" requiresUniqueEmail="false" passwordFormat="Hashed" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="7" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" />
  </providers>
</membership>

<roleManager enabled="true" defaultProvider="UBCATSqlRoleProvider" cookieTimeout="60">
  <providers>
    <clear />
    <add connectionStringName="UBCATDB" applicationName="UBCAT" name="UBCATSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" />
  </providers>
</roleManager>

<compilation debug="true" targetFramework="4.0">
  <assemblies>
    <add assembly="System.Security, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
    <add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
    <add assembly="System.Data.Entity.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
  </assemblies>
  <buildProviders>
    <add extension=".edmx" type="System.Data.Entity.Design.AspNet.EntityDesignerBuildProvider" />
  </buildProviders>
</compilation>

1 个答案:

答案 0 :(得分:0)

首先,您正在使用legacy Membership Provider。以下是新的ASP.NET Universal Providers ,它与旧的成员资格提供程序向后兼容。

如果您需要最新的成员资格提供程序,您希望查看与遗留成员资格提供程序不向后兼容的ASP.NET Identity

  

用户'admin'登录失败。

根据错误消息,SQL Server的登录凭据不正确。