2009-06-30 69 views
7

我在本地有一個asp.net mvc網站的工作副本。我只是將整個網站上傳到我的網站託管服務器。一切看起來不錯,但是當我登錄時,我得到以下錯誤:System.ArgumentException:不支持的關鍵字:'provider'

System.ArgumentException:不支持的關鍵字:'provider'。

[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 

有什麼建議嗎?

回答

7

The value that was provided for the connection string may be wrong, or it may contain an invalid syntax.

我的建議是修復配置字符串。

8

MSDN article包含ConnectionString中用於SqlConnection對象的所有允許的關鍵字值。 「提供者」不在列表中。

你有兩個選擇:

  • 刪除 「提供者」 的關鍵字;
  • 使用OleDbConnection而不是SqlConnection。
2

從連接字符串中刪除"Provider=MSDORA"。然後這應該工作。

2

而且當你的連接字符串參數「用戶ID」使用空間,如果是寫爲「用戶名」,那麼也提示錯誤

0

關注於這就需要空間ConnectionString中的關鍵字。像User ID是正確的,但UserID將失敗。

相關問題