Advertisement
Guest User

Untitled

a guest
Aug 13th, 2018
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.32 KB | None | 0 0
  1. Asp.net Mvc 3 connection string issue
  2. <connectionStrings>
  3. <add name="ApplicationServices" connectionString="Data Source=d5d3955e-1183-4e10-8892-9f9d005af0a8.sqlserver.sequelizer.com;Initial Catalog=dbd5d3955e11834e1088929f9d005af0a8;Persist Security Info=True;User ID=juydqjglrdwrhgsr;Password=***********" providerName="System.Data.SqlClient" />
  4. <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;Initial Catalog=dbd5d3955e11834e1088929f9d005af0a8;Persist Security Info=True;User ID=juydqjglrdwrhgsr;Password=***********"" providerName="System.Data.EntityClient" />
  5. </connectionStrings>
  6.  
  7. Login failed for user 'juydqjglrdwrhgsr'.
  8.  
  9. 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.
  10.  
  11. Exception Details: System.Data.SqlClient.SqlException: Login failed for user 'juydqjglrdwrhgsr'.
  12.  
  13. Source Error:
  14.  
  15.  
  16. Line 32: <li>@Html.ActionLink("Home", "Index", "Home")</li>
  17. Line 33: @{
  18. Line 34: if(User.IsInRole("Admin"))
  19. Line 35: {
  20. Line 36: <li>@Html.ActionLink("Admin Controls", "Index", "Admin")</li>
  21.  
  22. Source File: c:UsersAdministratorDocumentsVisual Studio 2010ProjectsTraxzTraxzViewsShared_Layout.cshtml Line: 34
  23.  
  24. Stack Trace:
  25.  
  26.  
  27. [SqlException (0x80131904): Login failed for user 'juydqjglrdwrhgsr'.]
  28. System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +5064474
  29. System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning() +234
  30. System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +2275
  31. System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK) +35
  32. System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, SqlConnection owningObject) +183
  33. System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, TimeoutTimer timeout) +239
  34. System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, TimeoutTimer timeout, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +195
  35. System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +232
  36. System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +185
  37. System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) +33
  38. System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) +524
  39. System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) +66
  40. System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +479
  41. System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +108
  42. System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +126
  43. System.Data.SqlClient.SqlConnection.Open() +125
  44. System.Web.DataAccess.SqlConnectionHolder.Open(HttpContext context, Boolean revertImpersonate) +95
  45. System.Web.DataAccess.SqlConnectionHelper.GetConnection(String connectionString, Boolean revertImpersonation) +206
  46. System.Web.Security.SqlRoleProvider.GetRolesForUser(String username) +847
  47. WebMatrix.WebData.SimpleRoleProvider.GetRolesForUser(String username) +58
  48. System.Web.Security.RolePrincipal.IsInRole(String role) +182
  49. ASP._Page_Views_Shared__Layout_cshtml.Execute() in c:UsersAdministratorDocumentsVisual Studio 2010ProjectsTraxzTraxzViewsShared_Layout.cshtml:34
  50. System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +272
  51. System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +81
  52. System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +187
  53. System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer) +52
  54. System.Web.WebPages.<>c__DisplayClass7.<RenderPageCore>b__6(TextWriter writer) +203
  55. System.Web.WebPages.HelperResult.WriteTo(TextWriter writer) +42
  56. System.Web.WebPages.WebPageExecutingBase.WriteTo(TextWriter writer, HelperResult content) +45
  57. System.Web.WebPages.WebPageBase.Write(HelperResult result) +48
  58. System.Web.WebPages.WebPageBase.RenderSurrounding(String partialViewName, Action`1 body) +178
  59. System.Web.WebPages.WebPageBase.PopContext() +338
  60. System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +196
  61. System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance) +220
  62. System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer) +115
  63. System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +303
  64. System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult) +13
  65. System.Web.Mvc.<>c__DisplayClass1c.<InvokeActionResultWithFilters>b__19() +23
  66. System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +260
  67. System.Web.Mvc.<>c__DisplayClass1e.<InvokeActionResultWithFilters>b__1b() +19
  68. System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) +177
  69. System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +343
  70. System.Web.Mvc.Controller.ExecuteCore() +116
  71. System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +97
  72. System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +10
  73. System.Web.Mvc.<>c__DisplayClassb.<BeginProcessRequest>b__5() +37
  74. System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +21
  75. System.Web.Mvc.Async.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _) +12
  76. System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62
  77. System.Web.Mvc.<>c__DisplayClasse.<EndProcessRequest>b__d() +50
  78. System.Web.Mvc.SecurityUtil.<GetCallInAppTrustThunk>b__0(Action f) +7
  79. System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Action action) +22
  80. System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +60
  81. System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9
  82. System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +8963149
  83. System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +184
  84.  
  85. If you take advantage of the Sequelizer MySQL and MS SQL Server add-ons, SQLSERVER_CONNECTION_STRING and SQLSERVER_URI settings will be injected into your application appSettings. SQLSERVER_CONNECTION_STRING_ALIAS will also be inserted if you add an alias. Further, the connection string will be placed in the connectionStrings element with name set to the alias if one is specified.
  86.  
  87. The uri is of the following format: sqlserver://username:password@hostname/databasename. If you want, you can create your own connection string (if, for example, you need a custom one for Entity Framework). Here's an example of building a standard connection string:
  88.  
  89. var uriString = ConfigurationManager.AppSettings["SQLSERVER_URI"];
  90. var uri = new Uri(uriString);
  91. var connectionString = new SqlConnectionStringBuilder
  92. {
  93. DataSource = uri.Host,
  94. InitialCatalog = uri.AbsolutePath.Trim('/'),
  95. UserID = uri.UserInfo.Split(':').First(),
  96. Password = uri.UserInfo.Split(':').Last(),
  97. }.ConnectionString;
  98.  
  99. <add name="TraxzDBEntities" connectionString="metadata=res://*/Models.DBModel.csdl|res://*/Models.DBModel.ssdl|res://*/Models.DBModel.msl;&#xD;&#xA; provider=System.Data.SqlClient;&#xD;&#xA; provider connection string="&#xD;&#xA; Data Source=YOURPROVIDERDATASOURCE;&#xD;&#xA; User ID=YourUserName; &#xD;&#xA; Password=YourPassword;&#xD;&#xA; Initial Catalog=YourCatalog;&#xD;&#xA; Persist Security Info=True;&#xD;&#xA; MultipleActiveResultSets=True"" providerName="System.Data.EntityClient" />
  100.  
  101. string baseConnectionString = ConfigurationManager.ConnectionStrings["TraxzDBEntities"].ConnectionString;
  102.  
  103. EntityConnectionStringBuilder entityBuilder = new EntityConnectionStringBuilder();
  104. entityBuilder.Provider = "System.Data.SqlClient";
  105. entityBuilder.ProviderConnectionString = baseConnectionString;
  106. entityBuilder.Metadata = @"res://*/";
  107.  
  108. return entityBuilder.ToString();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement