Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sql-server/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net Can';t将Visual Web Developer连接到SQL Server_Asp.net_Sql Server_Database Connection - Fatal编程技术网

Asp.net Can';t将Visual Web Developer连接到SQL Server

Asp.net Can';t将Visual Web Developer连接到SQL Server,asp.net,sql-server,database-connection,Asp.net,Sql Server,Database Connection,我有一个非常好的、工作正常的数据库和网站,出于某种原因,我突然登录,发现错误: 无法打开登录请求的数据库“BookDatabase”。登录失败。 用户登录失败 和堆栈跟踪: [SqlException(0x80131904):无法打开登录请求的数据库“BookDatabase”。登录失败。用户登录失败 “GSCC-L10017\acallus”。] System.Data.SqlClient.SqlInternalConnection.OnError(SqlException 异常,布尔断开连接

我有一个非常好的、工作正常的数据库和网站,出于某种原因,我突然登录,发现错误:

无法打开登录请求的数据库“BookDatabase”。登录失败。 用户登录失败

和堆栈跟踪:

[SqlException(0x80131904):无法打开登录请求的数据库“BookDatabase”。登录失败。用户登录失败 “GSCC-L10017\acallus”。]
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException 异常,布尔断开连接)+5096342
System.Data.SqlClient.TdsParser.throweexception和warning()+234
System.Data.SqlClient.TdsParser.Run(RunBehavior, SqlCommand cmdHandler、SqlDataReader数据流、, BulkCopySimpleResultSet bulkCopyHandler,TdsParserStateObject stateObj)+2294
System.Data.SqlClient.sqlinternalconnectionds.CompleteLogin(布尔值 正常)+35
System.Data.SqlClient.sqlinternalconnectionds.AttemptOneLogin(ServerInfo serverInfo、字符串newPassword、布尔值IgnoresInOpenTimeout、, TimeoutTimer超时,SqlConnection owningObject)+245
System.Data.SqlClient.sqlinternalconnectionds.loginnofilover(ServerInfo serverInfo、字符串newPassword、布尔重定向EducserInstance、, SqlConnection owningObject、SqlConnectionString connectionOptions、, TimeoutTimer timeout)+703
System.Data.SqlClient.sqlinternalconnectionds.OpenLoginEnlist(SqlConnection owningObject、TimeoutTimer、SqlConnectionString 连接选项、字符串newPassword、布尔重定向edUserInstance) +195 System.Data.SqlClient.SqlInternalConnectionDS..ctor(DbConnectionPoolIdentity 标识、SqlConnectionString连接选项、对象提供程序信息、, 字符串newPassword,SqlConnection owningObject,布尔值 重定向导出实例)+232
System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions 选项、对象池组ProviderInfo、数据库连接池池、, DbConnection owningConnection)+185
System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection、DbConnectionPool池、DbConnectionOptions选项) +33 System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection 拥有对象)+524
System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection 拥有对象)+66
System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection 拥有对象)+479
System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection 拥有连接)+108
System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection 外部连接,DbConnectionFactory连接工厂)+126
System.Data.SqlClient.SqlConnection.Open()+125
System.Web.DataAccess.SqlConnectionHolder.Open(HttpContext上下文, 布尔值+95
System.Web.DataAccess.SqlConnectionHelper.GetConnection(字符串 connectionString,布尔值还原模拟)+206
System.Web.Security.SqlMembershipProvider.GetPasswordWithFormat(字符串 用户名,布尔值updateLastLoginActivityDate,Int32&状态,字符串& 密码、Int32和passwordFormat、字符串和密码、Int32& failedPasswordAttemptCount、Int32和failedPasswordAnswerAttemptCount, 布尔值&isApproved,日期时间&lastLoginDate,日期时间& 上次活动日期)+827
System.Web.Security.SqlMembershipProvider.CheckPassword(字符串 用户名、字符串密码、布尔值updateLastLoginActivityDate、, Boolean failIfNotApproved、String和salt、Int32和passwordFormat)+105
System.Web.Security.SqlMembershipProvider.ValidateUser(字符串 用户名、字符串密码)+106
System.Web.UI.WebControls.Login.authenticateSingMembershipProvider(AuthenticateEventArgs e) +60
System.Web.UI.WebControls.Login.OnAuthenticate(AuthenticateEventArgs e) +129 System.Web.UI.WebControls.Login.AttemptLogin()+127
System.Web.UI.WebControls.Login.OnBubbleEvent(对象源,EventArgs e) +101 System.Web.UI.Control.RaiseBubbleEvent(对象源、, 事件args args)+37
System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e)+125
System.Web.UI.WebControl.Button.RaisePostBackEvent(字符串 事件参数)+167
System.Web.UI.WebControl.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(字符串 事件参数)+10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl,String eventArgument)+13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36 System.Web.UI.Page.ProcessRequestMain(布尔includeStagesBeforeAsyncPoint,布尔IncludeStagesSafterAsyncPoint) +5563

我已经尝试了我能找到的所有方法来解决这个问题,并且发现了以下几点: -数据库一次只能连接一个SQL Server Management Studio或Visual Web Developer-我再也不能让它同时在两个程序中工作了。 -即使我将它连接到VisualWebDeveloper,我仍然无法在我的站点上实际执行任何连接到数据库的操作(我得到了上面的错误)

我通过Windows身份验证连接到我的服务器实例,数据库位于我网站的App_数据文件夹中-我最初将其连接到Management Studio

我的web.config如下所示:

    <configuration>
  <system.web>
    <authorization>
      <allow roles="Administrator"/>
    </authorization>
    <roleManager enabled="true"/>
    <authentication mode="Forms"/>
    <compilation debug="false" targetFramework="4.0">
      <assemblies>
        <add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
        <add assembly="System.Web.Extensions.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
      </assemblies>
    </compilation>
    <membership>
      <providers>
        <remove name="AspNetSqlMembershipProvider"/>
        <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="LocalSqlServer" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true" applicationName="/" requiresUniqueEmail="true" passwordFormat="Hashed" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" passwordStrengthRegularExpression=""/>
      </providers>
    </membership>
  </system.web>
  <connectionStrings>
    <remove name="LocalSqlServer"/>
    <add name="LocalSqlServer" connectionString="Data Source=.\IPT2012;Initial Catalog=BookDatabase;Integrated Security=True" providerName="System.Data.SqlClient"/>
  </connectionStrings>
</configuration>


我什么都试过了。在我沮丧地真的扯掉头发之前,有人能解释一下这种情况吗。

在你的连接字符串中添加用户ID和密码属性

<connectionStrings>
 <remove name="LocalSqlServer"/>
 <add name="LocalSqlServer" connectionString="Data Source=.\IPT2012;Initial Catalog=BookDatabase;Integrated Security=True; User ID = userName; Password = yourpassword;" providerName="System.Data.SqlClient"/>
</connectionStrings>

Sql Server的哪个版本/版本?你能把所有的都给我吗