Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-mvc/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql server System.ArgumentException:不支持关键字:';供应商';_Sql Server_Asp.net Mvc - Fatal编程技术网

Sql server System.ArgumentException:不支持关键字:';供应商';

Sql server System.ArgumentException:不支持关键字:';供应商';,sql-server,asp.net-mvc,Sql Server,Asp.net Mvc,我在本地有一个asp.net mvc站点的工作副本。我刚刚把整个网站上传到我的主机服务器上。开始时一切看起来都很好,但当我登录时,出现以下错误: System.ArgumentException:不支持关键字:“提供者”。 [ArgumentException: Keyword not supported: 'provider'.] System.Data.Common.DbConnectionOptions.ParseInternal(Hashtable parsetable, Stri

我在本地有一个asp.net mvc站点的工作副本。我刚刚把整个网站上传到我的主机服务器上。开始时一切看起来都很好,但当我登录时,出现以下错误:

System.ArgumentException:不支持关键字:“提供者”。

[ArgumentException: Keyword not supported: 'provider'.]
   System.Data.Common.DbConnectionOptions.ParseInternal(Hashtable parsetable, String connectionString, Boolean buildChain, Hashtable synonyms, Boolean firstKey) +4907604
   System.Data.Common.DbConnectionOptions..ctor(String connectionString, Hashtable synonyms, Boolean useOdbcRules) +98
   System.Data.SqlClient.SqlConnectionString..ctor(String connectionString) +55
   System.Data.SqlClient.SqlConnectionFactory.CreateConnectionOptions(String connectionString, DbConnectionOptions previous) +24
   System.Data.ProviderBase.DbConnectionFactory.GetConnectionPoolGroup(String connectionString, DbConnectionPoolGroupOptions poolOptions, DbConnectionOptions& userConnectionOptions) +200
   System.Data.SqlClient.SqlConnection.ConnectionString_Set(String value) +62
   System.Data.SqlClient.SqlConnection.set_ConnectionString(String value) +4
   System.Data.SqlClient.SqlConnection..ctor(String connectionString) +24
   System.Web.DataAccess.SqlConnectionHolder..ctor(String connectionString) +54

[ArgumentException: An error occurred while attempting to initialize a System.Data.SqlClient.SqlConnection object. The value that was provided for the connection string may be wrong, or it may contain an invalid syntax.
Parameter name: connectionString]
   System.Web.DataAccess.SqlConnectionHolder..ctor(String connectionString) +136
   System.Web.DataAccess.SqlConnectionHelper.GetConnection(String connectionString, Boolean revertImpersonation) +134
   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) +815
   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) +78
   SalemGolf.Controllers.AccountMembershipService.ValidateUser(String userName, String password) in D:\Adam\Code\CSharp\Asp.net\SalemGolf\SalemGolf\Controllers\AccountController.cs:335
   SalemGolf.Controllers.AccountController.ValidateLogOn(String userName, String password) in D:\Adam\Code\CSharp\Asp.net\SalemGolf\SalemGolf\Controllers\AccountController.cs:207
   SalemGolf.Controllers.AccountController.LogOn(String userName, String password, Boolean rememberMe, String returnUrl) in D:\Adam\Code\CSharp\Asp.net\SalemGolf\SalemGolf\Controllers\AccountController.cs:59
   lambda_method(ExecutionScope , ControllerBase , Object[] ) +245
   System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +17
   System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +178
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +24
   System.Web.Mvc.<>c__DisplayClassa.<InvokeActionMethodWithFilters>b__7() +53
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +258
   System.Web.Mvc.<>c__DisplayClassc.<InvokeActionMethodWithFilters>b__9() +20
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +193
   System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +382
   System.Web.Mvc.Controller.ExecuteCore() +123
   System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +23
   System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +7
   System.Web.Mvc.MvcHandler.ProcessRequest(HttpContextBase httpContext) +144
   System.Web.Mvc.MvcHandler.ProcessRequest(HttpContext httpContext) +54
   System.Web.Mvc.MvcHandler.System.Web.IHttpHandler.ProcessRequest(HttpContext httpContext) +7
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +181
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75
[ArgumentException:不支持关键字:“提供程序”。]
System.Data.Common.DbConnectionOptions.ParseInternal(哈希表parsetable、字符串connectionString、布尔构建链、哈希表同义词、布尔第一键)+4907604
System.Data.Common.DbConnectionOptions..ctor(字符串连接字符串,哈希表同义词,布尔useOdbcRules)+98
System.Data.SqlClient.SqlConnectionString..ctor(String connectionString)+55
System.Data.SqlClient.SqlConnectionFactory.CreateConnectionOptions(String connectionString,DbConnectionOptions previous)+24
System.Data.ProviderBase.DbConnectionFactory.GetConnectionPoolGroup(String connectionString、DbConnectionPoolGroupOptions、DbConnectionOptions和userConnectionOptions)+200
System.Data.SqlClient.SqlConnection.ConnectionString_集(字符串值)+62
System.Data.SqlClient.SqlConnection.set_ConnectionString(字符串值)+4
System.Data.SqlClient.SqlConnection..ctor(字符串连接字符串)+24
System.Web.DataAccess.SqlConnectionHolder..ctor(字符串连接字符串)+54
[ArgumentException:尝试初始化System.Data.SqlClient.SqlConnection对象时出错。为连接字符串提供的值可能错误,或者可能包含无效语法。
参数名称:connectionString]
System.Web.DataAccess.SqlConnectionHolder..ctor(stringconnectionstring)+136
System.Web.DataAccess.SqlConnectionHelper.GetConnection(字符串connectionString,布尔值还原模拟)+134
System.Web.Security.SqlMembershipProvider.GetPasswordWithFormat(字符串用户名、布尔值updateLastLoginActivityDate、Int32和状态、字符串和密码、Int32和密码格式、字符串和密码盐、Int32和failedPasswordAttemptCount、Int32和failedPasswordAnswerAttemptCount、布尔值和isApproved、DateTime和lastLoginDate、DateTime和lastActivityDate) +815
System.Web.Security.SqlMembershipProvider.CheckPassword(字符串用户名、字符串密码、布尔值updateLastLoginActivityDate、布尔值failIfNotApproved、字符串和salt、Int32和passwordFormat)+105
System.Web.Security.SqlMembershipProvider.CheckPassword(字符串用户名、字符串密码、布尔值updateLastLoginActivityDate、布尔值failIfNotApproved)+42
System.Web.Security.SqlMembershipProvider.ValidateUser(字符串用户名、字符串密码)+78
D:\Adam\Code\CSharp\Asp.net\SalemGolf\SalemGolf\Controllers\AccountMembershipService.ValidateUser(字符串用户名,字符串密码)中的SalemGolf.Controllers.AccountMembershipService.ValidateUser(字符串用户名,字符串密码):335
D:\Adam\Code\CSharp\Asp.net\SalemGolf\SalemGolf\Controllers\AccountController.ValidateLogOn(字符串用户名,字符串密码)中的SalemGolf.Controllers.AccountController.ValidateLogOn(字符串用户名,字符串密码):207
D:\Adam\Code\CSharp\Asp.net\SalemGolf\SalemGolf\Controllers\AccountController.LogOn(字符串用户名、字符串密码、布尔记忆、字符串返回URL)中的SalemGolf.Controllers.AccountController.LogOn(字符串用户名、字符串密码、字符串返回URL):59
lambda_方法(ExecutionScope,ControllerBase,Object[])+245
System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase控制器,对象[]参数)+17
System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext ControllerContext,IDictionary`2参数)+178
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext ControllerContext,ActionDescriptor ActionDescriptor,IDictionary`2参数)+24
System.Web.Mvc.c__显示ClassA.b__7()+53
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter筛选器、ActionExecutingContext预文本、Func`1 continuation)+258
System.Web.Mvc.c__显示类c.b__9()+20
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext ControllerContext,IList`1筛选器,ActionDescriptor ActionDescriptor,IDictionary`2参数)+193
System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext ControllerContext,String actionName)+382
System.Web.Mvc.Controller.ExecuteCore()+123
System.Web.Mvc.ControllerBase.Execute(RequestContext-RequestContext)+23
System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext RequestContext)+7
ProcessRequest(HttpContextBase httpContext)+144
ProcessRequest(HttpContext HttpContext)+54
System.Web.Mvc.MvcHandler.System.Web.IHttpHandler.ProcessRequest(HttpContext HttpContext)+7
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()+181
System.Web.HttpApplication.ExecuteStep(IExecutionStep步骤,布尔值&同步完成)+75
有什么建议吗

为提供的值 连接字符串可能错误,或者 可能包含无效语法

我的建议是修复配置字符串。

这包含SqlConnection对象的ConnectionString中允许的所有关键字值。“提供者”不在列表中

您有两个选择:

  • 删除“提供者”关键字
  • 使用替代SqlConnection的连接

从连接字符串中删除
“Provider=MSDORA”
。然后这应该会起作用。

当您的连接字符串参数“User ID”使用空格时,如果它被写为“UserID”,那么它也会出现错误。

注意连接字符串中需要空格的关键字。Like
UserID
是正确的,但是
UserID
将失败