6

Tôi đang tạo một ứng dụng trên APPHARBOR và tôi có một mô hình thực thể để truy vấn máy chủ SQL. String Sau đây là givving tôi lỗi:Chuỗi kết nối SQL ASP.Net MVC3

<add name="TraxzDBEntities" 
      connectionString="metadata=res://*/Models.DBModel.csdl|res://*/Models.DBModel.ssdl|res://*/Models.DBModel.msl; 
      provider=System.Data.SqlClient; 
      provider connection string='Data Source=d5d3955e-1183-4e10-8892-9f9d005af0a8.sqlserver.sequelizer.com; 
      User ID=**; 
      Password=**; 
      Initial Catalog=dbd5d3955e11834e1088929f9d005af0a8;Integrated Security=true; 
      MultipleActiveResultSets=True'" 
     providerName="System.Data.EntityClient" /> 

Đây là stack trace: Mô tả: Một ngoại lệ unhandled xảy ra trong quá trình thực hiện các yêu cầu web hiện hành. Vui lòng xem lại dấu vết ngăn xếp để biết thêm thông tin về lỗi và vị trí bắt nguồn từ mã.

Chi tiết ngoại lệ: System.ArgumentException: Từ khóa không được hỗ trợ: 'server'.

Lỗi nguồn:

Một ngoại lệ chưa được xử lý được tạo trong khi thực hiện yêu cầu web hiện tại. Thông tin về nguồn gốc và vị trí của ngoại lệ có thể được xác định bằng cách sử dụng dấu vết ngăn xếp ngoại lệ bên dưới.

Stack Trace:

[ArgumentException: Keyword not supported: 'server'.] 
    System.Data.Common.DbConnectionOptions.ParseInternal(Hashtable parsetable, String connectionString, Boolean buildChain, Hashtable synonyms, Boolean firstKey) +5110868 
    System.Data.Common.DbConnectionOptions..ctor(String connectionString, Hashtable synonyms, Boolean useOdbcRules) +98 
    System.Data.EntityClient.EntityConnection.ChangeConnectionString(String newConnectionString) +112 
    System.Data.EntityClient.EntityConnection..ctor(String connectionString) +77 
    System.Data.Entity.Internal.LazyInternalConnection.TryInitializeFromAppConfig(String name, ConnectionStringSettingsCollection connectionStrings) +309 
    System.Data.Entity.Internal.LazyInternalConnection.Initialize() +52 
    System.Data.Entity.Internal.LazyInternalConnection.get_ConnectionHasModel() +10 
    System.Data.Entity.Internal.LazyInternalContext.InitializeContext() +265 
    System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType) +18 
    System.Data.Entity.Internal.Linq.InternalSet`1.Initialize() +62 
    System.Data.Entity.Internal.Linq.InternalSet`1.get_InternalContext() +15 
    System.Data.Entity.Infrastructure.DbQuery`1.System.Linq.IQueryable.get_Provider() +37 
    System.Linq.Queryable.Where(IQueryable`1 source, Expression`1 predicate) +63 
    Traxz.Models.TraxzRepository.getListOfUserExerciseSessions(Guid userID) in d:\temp\lhvy3m2t.j0d\input\Traxz\Models\TraxzRepository.cs:77 
    Traxz.Controllers.ExerciseSessionController.listSessions(Nullable`1 page, Nullable`1 SessionID) in d:\temp\lhvy3m2t.j0d\input\Traxz\Controllers\ExerciseSessionController.cs:34 
    lambda_method(Closure , ControllerBase , Object[]) +164 
    System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +17 
    System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +208 
    System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +27 
    System.Web.Mvc.<>c__DisplayClass15.<InvokeActionMethodWithFilters>b__12() +55 
    System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +263 
    System.Web.Mvc.<>c__DisplayClass17.<InvokeActionMethodWithFilters>b__14() +19 
    System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +191 
    System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +343 
    System.Web.Mvc.Controller.ExecuteCore() +116 
    System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +97 
    System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +10 
    System.Web.Mvc.<>c__DisplayClassb.<BeginProcessRequest>b__5() +37 
    System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +21 
    System.Web.Mvc.Async.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _) +12 
    System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62 
    System.Web.Mvc.<>c__DisplayClasse.<EndProcessRequest>b__d() +50 
    System.Web.Mvc.SecurityUtil.<GetCallInAppTrustThunk>b__0(Action f) +7 
    System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Action action) +22 
    System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +60 
    System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9 
    System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +8963149 
    System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +184 

tôi đã lãng phí nhiều giờ về vấn đề này, và idk những gì là sai .. Xin vui lòng giúp đỡ.

Trả lời

4

Có vẻ như một số chuỗi kết nối khác đang được sử dụng tại đây. Bạn có thiết lập một chuỗi kết nối trong mã không? trong dự án asp.net MVC của bạn tất cả các chuỗi kết nối trong web.config là gì? Chỉ cần ở trên?

Tìm toàn bộ giải pháp của bạn cho từ "máy chủ"

+0

Đồng ý, tôi đã có điều này xảy ra và nó đã kết thúc là một chuỗi kết nối khác nhau được tham chiếu bởi nhà thiết kế. –

+0

Vâng tôi đã đọc một số tài liệu trên appharbor và nó xuất hiện rằng họ buộc bạn phải xây dựng một chuỗi kết nối động - nhưng tôi đã thử nghiệm chuỗi này và nó truy vấn máy chủ sql được lưu trữ một cách chính xác. – Aziz

+0

Sau đó, bạn đang để lại các chi tiết quan trọng. Chuỗi kết nối động này là gì? Tôi sẽ mạo hiểm để nói rằng nó không hoạt động chính xác bởi lỗi ở trên. –

1

Bổ sung vào đề nghị của Adam (mà có lẽ là câu trả lời), trong mã của bạn đoạn mã bạn không có một ; sau Password=** (có lẽ bạn làm trong mã thực mặc dù). Và bạn cũng đang sử dụng cả tên người dùng và mật khẩu và Integrated Security=true; không có ý nghĩa với tôi vì Integrated Security=true; có nghĩa là sử dụng người dùng hiện đã đăng nhập.

+0

tôi đã thử xóa Integrated Security = true; - tuy nhiên điều này không có hiệu lực. – Aziz

Các vấn đề liên quan