查看: 1031|回复: 6
|
asp.net SQL server Database Connection
[复制链接]
|
|
各位大哥大姐帮帮忙,我的project database(SQL Server) connection 有问题,到底是那里错呢?
这是 webconfig setting:
<sessionState
mode="SQLServer"
stateConnectionString="tcpip=127.0.0.1:42424"
sqlConnectionString="data source=.;user id=sa"
cookieless="false"
timeout="1440"
/>
以下是我encounter的 error message:
Server Error in '/AppDevelopment' Application.
Cannot open database requested in login 'ASPState'. Login fails. Login failed for user 'sa'.
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: Cannot open database requested in login 'ASPState'. Login fails. Login failed for user 'sa'.
[SqlException: Cannot open database requested in login 'ASPState'. Login fails.
Login failed for user 'sa'.]
System.Data.SqlClient.ConnectionPool.GetConnection(Boolean& isInTransaction) +474
System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnectionString options, Boolean& isInTransaction) +372
System.Data.SqlClient.SqlConnection.Open() +384
System.Web.SessionState.SqlStateConnection..ctor(String sqlconnectionstring) +92
[HttpException (0x80004005): Unable to connect to SQL Server session database.]
System.Web.SessionState.SqlStateConnection..ctor(String sqlconnectionstring) +190
System.Web.SessionState.SqlStateClientManager.GetConnection(Boolean& usePooling) +98
System.Web.SessionState.SqlStateClientManager.SetAsyncWorker(String id, SessionStateItem item, Byte[] buf, Int32 length, Boolean inStorage) +43
System.Web.SessionState.SqlStateClientManager.System.Web.SessionState.IStateClientManager.Set(String id, SessionStateItem item, Boolean inStorage) +147
System.Web.SessionState.SessionStateModule.OnReleaseState(Object source, EventArgs eventArgs) +465
System.Web.SessionState.SessionStateModule.OnEndRequest(Object source, EventArgs eventArgs) +44
System.Web.SyncEventExecutionStep.System.Web.HttpApplication+IExecutionStep.Execute() +60
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +87 |
|
|
|
|
|
|
|
发表于 19-6-2006 09:49 AM
|
显示全部楼层
sqlConnectionString="data source=.;user id=sa"
你的 data source? 你的 password? |
|
|
|
|
|
|
|

楼主 |
发表于 19-6-2006 10:18 AM
|
显示全部楼层
data source 是 local Database
我是用 SQL Server Authentication mode。
but 没有 set password. |
|
|
|
|
|
|
|
发表于 19-6-2006 01:56 PM
|
显示全部楼层
尝试看:
sqlConnectionString="data source=(local);user id=sa;pwd=;"
但你得确定你不是用 windows authentication. |
|
|
|
|
|
|
|

楼主 |
发表于 19-6-2006 03:25 PM
|
显示全部楼层
|
|
|
|
|
|
|
发表于 19-6-2006 11:10 PM
|
显示全部楼层
server=10.1.2.3;database=dbname;uid=sa;pwd=strpwd |
|
|
|
|
|
|
|
发表于 20-6-2006 09:17 AM
|
显示全部楼层
原帖由 逍遥童子 于 19-6-2006 03:25 PM 发表
这个方法已试过,但还是行不通。
由于没有 password, 很可能你已经是 windows authentication, 尝试看看:
sqlConnectionString = "Persist Security Info=False;Data Source=(local);Initial Catalog=database_name;Integrated Security=SSPI" |
|
|
|
|
|
|
| |
本周最热论坛帖子
|