Discussion:
AsP.net 2.0 聯結資料庫錯誤
(时间太久无法回复)
無助的人
2006-05-22 02:57:01 UTC
Permalink
hi 你好

我是剛學asp2.0幾個月,現在遇到一個棘手的問題,就是登入後常常出現錯誤,我在討論區上看到你已經解決,我在兩個星期就要交報告,可否請你教教我!!

============================

Server Error in '/WebSite1' Application.
--------------------------------------------------------------------------------

在檔案 C:\Documents and Settings\Ja.Wang\Desktop\WebSite1\App_Data\aspnetdb.mdf
附加自動命名的資料庫之嘗試失敗。相同名稱的資料庫已經存在、無法開啟指定的檔案或者它位於 UNC 共用中。
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: 在檔案 C:\Documents and
Settings\Ja.Wang\Desktop\WebSite1\App_Data\aspnetdb.mdf
附加自動命名的資料庫之嘗試失敗。相同名稱的資料庫已經存在、無法開啟指定的檔案或者它位於 UNC 共用中。

Source Error:


An unhandled exception was generated during the execution of the current web
request. Information regarding the origin and location of the exception can
be identified using the exception stack trace below.


Stack Trace:


[SqlException (0x80131904): 在檔案 C:\Documents and
Settings\Ja.Wang\Desktop\WebSite1\App_Data\aspnetdb.mdf
附加自動命名的資料庫之嘗試失敗。相同名稱的資料庫已經存在、無法開啟指定的檔案或者它位於 UNC 共用中。]
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException
exception, Boolean breakConnection) +734963

System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject
stateObj) +188
System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand
cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet
bulkCopyHandler, TdsParserStateObject stateObj) +1838
System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean
enlistOK) +33

System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection
owningObject, SqlConnectionString connectionOptions, String newPassword,
Boolean redirectedUserInstance) +628

System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity
identity, SqlConnectionString connectionOptions, Object providerInfo, String
newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +170

System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions
options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection
owningConnection) +359

System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) +28
System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection
owningObject) +424
System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection
owningObject) +66
System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection
owningObject) +496
System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection
owningConnection) +82
System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection
outerConnection, DbConnectionFactory connectionFactory) +105
System.Data.SqlClient.SqlConnection.Open() +111
System.Web.DataAccess.SqlConnectionHolder.Open(HttpContext context,
Boolean revertImpersonate) +84
System.Web.DataAccess.SqlConnectionHelper.GetConnection(String
connectionString, Boolean revertImpersonation) +197
System.Web.Security.SqlMembershipProvider.GetPasswordWithFormat(String
username, Boolean updateLastLoginActivityDate, Int32& status, String&
password, Int32& passwordFormat, String& passwordSalt, Int32&
failedPasswordAttemptCount, Int32& failedPasswordAnswerAttemptCount, Boolean&
isApproved, DateTime& lastLoginDate, DateTime& lastActivityDate) +1121
System.Web.Security.SqlMembershipProvider.CheckPassword(String username,
String password, Boolean updateLastLoginActivityDate, Boolean
failIfNotApproved, String& salt, Int32& passwordFormat) +105
System.Web.Security.SqlMembershipProvider.CheckPassword(String username,
String password, Boolean updateLastLoginActivityDate, Boolean
failIfNotApproved) +42
System.Web.Security.SqlMembershipProvider.ValidateUser(String username,
String password) +83
System.Web.UI.WebControls.Login.OnAuthenticate(AuthenticateEventArgs e)
+160
System.Web.UI.WebControls.Login.AttemptLogin() +105
System.Web.UI.WebControls.Login.OnBubbleEvent(Object source, EventArgs e)
+99
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +35
System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e) +115
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
+163

System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102






--------------------------------------------------------------------------------

Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET
Version:2.0.50727.42

==============================
my web.config

<?xml version="1.0"?>
<!--
Note: As an alternative to hand editing this file you can use the
web admin tool to configure settings for your application. Use
the Website->Asp.Net Configuration option in Visual Studio.
A full list of settings and comments can be found in
machine.config.comments usually located in
\Windows\Microsoft.Net\Framework\v2.x\Config
-->
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<appSettings>
<add key="CompanyName" value="網際網路公司" />
</appSettings>
<connectionStrings>
<add name="northwndConnectionString1" connectionString="Data
Source=.\SQLEXPRESS;AttachDbFilename=C:\ASPNET20_Sample\Database\northwnd.mdf;Integrated Security=True;User Instance=True"
providerName="System.Data.SqlClient" />
<add name="NorthwindConnectionString1" connectionString="Data
Source=.\SQLEXPRESS;AttachDbFilename=C:\ASPNET20_Sample\Database\northwnd.mdf;Integrated Security=True;User Instance=True"
providerName="System.Data.SqlClient" />
<add name="AppConnectionString1" connectionString="Data
Source=.\SQLEXPRESS;AttachDbFilename=C:\ASPNET20_Sample\Database\northwnd.mdf;Integrated Security=True;User Instance=True"
providerName="System.Data.SqlClient" />
<add name="northwndConnectionString2" connectionString="Data
Source=.\SQLEXPRESS;AttachDbFilename=C:\ASPNET20_Sample\Database\northwnd.mdf;Integrated Security=True;User Instance=True"
providerName="System.Data.SqlClient" />
</connectionStrings>


<system.web>
<globalization
fileEncoding="big5"
requestEncoding="big5"
responseEncoding="big5"
culture="zh-TW"
/>
<anonymousIdentification enabled="true" />
<!--
Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.
-->
<roleManager enabled="true" />
<compilation debug="true"/>
<!--
The <authentication> section enables configuration of the
security authentication
mode used by ASP.NET to identify an incoming user.
-->
<authentication mode="Forms">
<forms loginUrl="Anonymous\login.aspx" />
</authentication>
<!--
The <customErrors> section enables configuration of what to do
if/when an unhandled
error occurs during the execution of a request. Specifically,
it enables developers
to configure html error pages to be displayed in place of a
error stack trace.
-->
<customErrors defaultRedirect="" />
<profile>
<properties>
<add name="中文姓名" type="System.String" />
<add name="Theme" defaultValue="NoTheme" type="System.String" />
<add name="CustomerID" type="System.String" />
<add name="興趣" type="System.String" allowAnonymous="true" />
<add name="簡稱" type="System.String" allowAnonymous="true" />
<group name="個人資訊">
<add name="年齡" type="System.Int64" />
<add name="生日" type="System.DateTime" />
<add name="性別" type="System.Boolean" />
</group>
</properties>
</profile>
<siteMap defaultProvider="XmlSiteMapProvider" enabled="true">
<providers>
<add name="XmlSiteMapProvider"
description="SiteMap provider which reads in .sitemap
XML files."
type="System.Web.XmlSiteMapProvider, System.Web,
Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
siteMapFile="Web.sitemap" securityTrimmingEnabled="true"/>
</providers>
</siteMap>
<webParts enableExport ="true">
</webParts>

</system.web>
</configuration>
Jason
2006-05-22 03:42:05 UTC
Permalink
hi §AŠn
============================
Server Error in '/WebSite1' Application.
--------------------------------------------------------------------------------
ŠbÀÉ®× C:\Documents and
Settings\Ja.Wang\Desktop\WebSite1\App_Data\aspnetdb.mdf
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: ŠbÀÉ®× C:\Documents
and
Settings\Ja.Wang\Desktop\WebSite1\App_Data\aspnetdb.mdf
An unhandled exception was generated during the execution of the current web
request. Information regarding the origin and location of the exception can
be identified using the exception stack trace below.
[SqlException (0x80131904): ŠbÀÉ®× C:\Documents and
Settings\Ja.Wang\Desktop\WebSite1\App_Data\aspnetdb.mdf
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException
exception, Boolean breakConnection) +734963
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject
stateObj) +188
System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand
cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet
bulkCopyHandler, TdsParserStateObject stateObj) +1838
System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean
enlistOK) +33
System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection
owningObject, SqlConnectionString connectionOptions, String newPassword,
Boolean redirectedUserInstance) +628
System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity
identity, SqlConnectionString connectionOptions, Object providerInfo, String
newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +170
System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions
options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection
owningConnection) +359
System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection
owningConnection, DbConnectionPool pool, DbConnectionOptions options) +28
System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection
owningObject) +424
System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection
owningObject) +66
System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection
owningObject) +496
System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection
owningConnection) +82
System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection
outerConnection, DbConnectionFactory connectionFactory) +105
System.Data.SqlClient.SqlConnection.Open() +111
System.Web.DataAccess.SqlConnectionHolder.Open(HttpContext context,
Boolean revertImpersonate) +84
System.Web.DataAccess.SqlConnectionHelper.GetConnection(String
connectionString, Boolean revertImpersonation) +197
System.Web.Security.SqlMembershipProvider.GetPasswordWithFormat(String
username, Boolean updateLastLoginActivityDate, Int32& status, String&
password, Int32& passwordFormat, String& passwordSalt, Int32&
failedPasswordAttemptCount, Int32& failedPasswordAnswerAttemptCount, Boolean&
isApproved, DateTime& lastLoginDate, DateTime& lastActivityDate) +1121
System.Web.Security.SqlMembershipProvider.CheckPassword(String username,
String password, Boolean updateLastLoginActivityDate, Boolean
failIfNotApproved, String& salt, Int32& passwordFormat) +105
System.Web.Security.SqlMembershipProvider.CheckPassword(String username,
String password, Boolean updateLastLoginActivityDate, Boolean
failIfNotApproved) +42
System.Web.Security.SqlMembershipProvider.ValidateUser(String username,
String password) +83
System.Web.UI.WebControls.Login.OnAuthenticate(AuthenticateEventArgs e)
+160
System.Web.UI.WebControls.Login.AttemptLogin() +105
System.Web.UI.WebControls.Login.OnBubbleEvent(Object source, EventArgs e)
+99
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +35
System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e) +115
System.Web.UI.WebControls.Button.RaisePostBackEvent(String
eventArgument)
+163
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String
eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET
Version:2.0.50727.42
==============================
my web.config
<?xml version="1.0"?>
<!--
Note: As an alternative to hand editing this file you can use the
web admin tool to configure settings for your application. Use
the Website->Asp.Net Configuration option in Visual Studio.
A full list of settings and comments can be found in
machine.config.comments usually located in
\Windows\Microsoft.Net\Framework\v2.x\Config
-->
<configuration
xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<appSettings>
<add key="CompanyName" value="ºô»Úºôžô€œ¥q" />
</appSettings>
<connectionStrings>
<add name="northwndConnectionString1" connectionString="Data
Source=.\SQLEXPRESS;AttachDbFilename=C:\ASPNET20_Sample\Database\northwnd.mdf;Integrated
Security=True;User Instance=True"
providerName="System.Data.SqlClient" />
<add name="NorthwindConnectionString1" connectionString="Data
Source=.\SQLEXPRESS;AttachDbFilename=C:\ASPNET20_Sample\Database\northwnd.mdf;Integrated
Security=True;User Instance=True"
providerName="System.Data.SqlClient" />
<add name="AppConnectionString1" connectionString="Data
Source=.\SQLEXPRESS;AttachDbFilename=C:\ASPNET20_Sample\Database\northwnd.mdf;Integrated
Security=True;User Instance=True"
providerName="System.Data.SqlClient" />
<add name="northwndConnectionString2" connectionString="Data
Source=.\SQLEXPRESS;AttachDbFilename=C:\ASPNET20_Sample\Database\northwnd.mdf;Integrated
Security=True;User Instance=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
<system.web>
<globalization
fileEncoding="big5"
requestEncoding="big5"
responseEncoding="big5"
culture="zh-TW"
/>
<anonymousIdentification enabled="true" />
<!--
Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.
-->
<roleManager enabled="true" />
<compilation debug="true"/>
<!--
The <authentication> section enables configuration of the
security authentication
mode used by ASP.NET to identify an incoming user.
-->
<authentication mode="Forms">
<forms loginUrl="Anonymous\login.aspx" />
</authentication>
<!--
The <customErrors> section enables configuration of what to do
if/when an unhandled
error occurs during the execution of a request. Specifically,
it enables developers
to configure html error pages to be displayed in place of a
error stack trace.
-->
<customErrors defaultRedirect="" />
<profile>
<properties>
<add name="€€€å©mŠW" type="System.String" />
<add name="Theme" defaultValue="NoTheme" type="System.String" />
<add name="CustomerID" type="System.String" />
<add name="¿³œì" type="System.String" allowAnonymous="true"
/>
<add name="²ºÙ" type="System.String" allowAnonymous="true" />
<group name="­Ó€Hžê°T">
<add name="Š~ÄÖ" type="System.Int64" />
<add name="¥Í€é" type="System.DateTime" />
<add name="©Ê§O" type="System.Boolean" />
</group>
</properties>
</profile>
<siteMap defaultProvider="XmlSiteMapProvider" enabled="true">
<providers>
<add name="XmlSiteMapProvider"
description="SiteMap provider which reads in .sitemap
XML files."
type="System.Web.XmlSiteMapProvider, System.Web,
Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
siteMapFile="Web.sitemap"
securityTrimmingEnabled="true"/>
</providers>
</siteMap>
<webParts enableExport ="true">
</webParts>
</system.web>
</configuration>
Loading...