sql - ASP.Net MVC3 SQL 连接字符串

标签 sql visual-studio-2010 asp.net-mvc-3 connection-string appharbor

我正在 APPHARBOR 上创建一个应用程序,并且我有一个用于查询 SQL 服务器的实体模型。以下字符串给我错误:

<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" />

这是堆栈跟踪:
说明:在执行当前 Web 请求期间发生未处理的异常。请查看堆栈跟踪以获取有关错误及其在代码中的来源的更多信息。

异常详细信息:System.ArgumentException:不支持关键字:“服务器”。

源错误:

执行当前 Web 请求期间生成了未处理的异常。可以使用下面的异常堆栈跟踪来识别有关异常来源和位置的信息。

堆栈跟踪:
[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

我在这上面浪费了很多时间,并知道出了什么问题..请帮忙。

最佳答案

这里似乎使用了其他一些连接字符串。您是否也在代码中设置连接字符串?
在您的 asp.net mvc 项目中,web.config 中的所有连接字符串是什么?就以上这些?

在整个解决方案中搜索“服务器”一词

关于sql - ASP.Net MVC3 SQL 连接字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8160424/

相关文章:

使用带有 ORDER BY 和 LIMIT 的 INNER JOIN 的 MySQL 更新

sql - 难以理解顺序 sql 查询

c++ - 数组的 Stackoverflow 数组

c# - 在 Html.DropDownlistFor 中获取多个选定值

php - MySql 加载数据本地语法?

sql - 使用连接从 Oracle 表中选择 4 个最新行

c# - 不在右键菜单中运行 Pex

visual-studio-2010 - Visual Studio 2010 是否在 C++ 项目之间破坏了 "Project Dependencies"?

c# - MVC 在布局代码之前执行 View 代码并破坏我的脚本顺序

javascript - FileContentResult - 防止浏览器缓存图像