PDA

View Full Version : Lỗi kết nối khi chạy website từ localhost?



GiangPhiNgu
09-07-2007, 11:47
Các bạn cho mình hỏi tại sao khi mình tạo ra trang web bằng VS2005 , ASP.net. Chạy bằng cách mở VS ra chạy thì ok ko sao cả. Nhưng mình muốn mở IE lên chạy bằng cách gõ URL localhost lên chạy nhưng nó chỉ lên được trang chủ mà thôi. Khi click lên trang có cơ sở dữ liệu thì nó lại báo lỗi sql như sau:

Server Error in '/website' Application.
________________________________________
Login failed for user 'HOME-EEB39CCB13\ASPNET'.
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 'HOME-EEB39CCB13\ASPNET'.

Source Error:

Line 35: catch (Exception ex)
Line 36: {
Line 37: throw ex;
Line 38: }
Line 39: finally

Source File: j:\Bao Cao Luan Van\new-th\TH\App_Code\GenericDataAccess.cs Line: 37

Stack Trace:

[SqlException (0x80131904): Login failed for user 'HOME-EEB39CCB13\ASPNET'.]
GenericDataAccess.ExcureSelectCommand(DbCommand command) in j:\Bao Cao Luan Van\new-th\TH\App_Code\GenericDataAccess.cs:37
CatalogAccess.GetLoaiSanPham() in j:\Bao Cao Luan Van\new-th\TH\App_Code\CatalogAccess.cs:28
UserControls_CategoriesList.Page_Load(Object sender, EventArgs e) in j:\Bao Cao Luan Van\new-th\TH\UserControls\LoaiSanPham.ascx.cs:20
System.Web.Util.CalliHelper.EventArgFunctionCaller (IntPtr fp, Object o, Object t, EventArgs e) +15
System.Web.Util.CalliEventHandlerDelegateProxy.Cal lback(Object sender, EventArgs e) +34
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +47
System.Web.UI.Control.LoadRecursive() +131
System.Web.UI.Control.LoadRecursive() +131
System.Web.UI.Control.LoadRecursive() +131
System.Web.UI.Control.LoadRecursive() +131
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1061

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

Xin các bạn chỉ giúp cho mình cách khắc phục và làm cách nào cho nó chạy trang web mà ko cần phải mở VS2005 lên. Cám ơn nhiều

xbacala
09-07-2007, 23:44
lỗi này do you dùng Trust connection string

chuyển qua dùng SQL user

GiangPhiNgu
10-07-2007, 00:31
bạn ơi, có thể nói rõ hơn được ko?Mình xin đính kèm file mà mình ghi connectionstring cho bạn xem. bạn có thể nói chi tiết hơn được chứ? Mình đã dùng SQL user ko dùng chế độ bảo mật theo win nữa mà theo sql. Ko biết mình nghĩ đúng ko?Cám ơn

GiangPhiNgu
10-07-2007, 00:35
Mình đã tạo ra user trong sql và chạy, nó báo lỗi này nè:


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

Login failed for user 'user1'.
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 'user1'.

Source Error:


Line 35: catch (Exception ex)
Line 36: {
Line 37: throw ex;
Line 38: }
Line 39: finally


Source File: j:\Bao Cao Luan Van\new-th\TH\App_Code\GenericDataAccess.cs Line: 37

Stack Trace:


[SqlException (0x80131904): Login failed for user 'user1'.]
GenericDataAccess.ExcureSelectCommand(DbCommand command) in j:\Bao Cao Luan Van\new-th\TH\App_Code\GenericDataAccess.cs:37
CatalogAccess.GetLoaiSanPham() in j:\Bao Cao Luan Van\new-th\TH\App_Code\CatalogAccess.cs:28
UserControls_CategoriesList.Page_Load(Object sender, EventArgs e) in j:\Bao Cao Luan Van\new-th\TH\UserControls\LoaiSanPham.ascx.cs:20
System.Web.Util.CalliHelper.EventArgFunctionCaller (IntPtr fp, Object o, Object t, EventArgs e) +15
System.Web.Util.CalliEventHandlerDelegateProxy.Cal lback(Object sender, EventArgs e) +34
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +47
System.Web.UI.Control.LoadRecursive() +131
System.Web.UI.Control.LoadRecursive() +131
System.Web.UI.Control.LoadRecursive() +131
System.Web.UI.Control.LoadRecursive() +131
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1061
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.210

GiangPhiNgu
10-07-2007, 00:43
à, tui làm được rồi, thank yu so much

tink50
21-03-2011, 00:03
Bạn có thể hứong dẫn mình fig lỗi này được ko? Mình cũng gặp phải mà search chưa ra.

tinhdongvien
24-03-2011, 16:55
sao khong ai trả lời vậy?

ntt999
25-03-2011, 20:21
thật sự mình đã xem qua các lỗi của bạn, hiện tại mình chỉ có thể gửi bạn cách sửa lỗi của mình hay làm, đó là nhập vào chính lỗi đó làm từ khóa để tìm trên google, đâu đó sẽ có câu trả lời cho bạn, chúc thành công nhé