Guest User

Untitled

a guest
Nov 12th, 2014
701
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public string GetFriendlyUrlString(string originalUrl)
  2. {
  3. var friendly = _cacheManager.Get(originalUrl.ToLower(), () =>
  4. (from f in _friendlyUrlRepository.ReadOnlyTable <--------- LINE 48
  5. where f.OriginalUrl == originalUrl
  6. select f.Url).ToList().SingleOrDefault());
  7.  
  8. return friendly ?? originalUrl;
  9. }
  10.  
  11.  
  12. System.InvalidOperationException
  13. Unexpected connection state. When using a wrapping provider ensure that the StateChange event is implemented on the wrapped DbConnection.
  14.  
  15. System.InvalidOperationException: Unexpected connection state. When using a wrapping provider ensure that the StateChange event is implemented on the wrapped DbConnection.
  16. at System.Data.Entity.Core.Objects.ObjectContext.EnsureContextIsEnlistedInCurrentTransaction[T](Transaction currentTransaction, Func`1 openConnection, T defaultValue)
  17. at System.Data.Entity.Core.Objects.ObjectContext.EnsureConnection(Boolean shouldMonitorTransactions)
  18. at System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction[T](Func`1 func, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction, Boolean releaseConnectionOnSuccess)
  19. at System.Data.Entity.Core.Objects.ObjectQuery`1.<>c__DisplayClass7.<GetResults>b__5()
  20. at System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute[TResult](Func`1 operation)
  21. at System.Data.Entity.Core.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption)
  22. at System.Data.Entity.Core.Objects.ObjectQuery`1.<System.Collections.Generic.IEnumerable<T>.GetEnumerator>b__0()
  23. at System.Data.Entity.Internal.LazyEnumerator`1.MoveNext()
  24. at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
  25. at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
  26. at Nop.Services.Seo.FriendlyUrlService.<>c__DisplayClass5.<GetFriendlyUrlString>b__4() in ...\Libraries\Nop.Services\Seo\FriendlyUrlService.cs:line 48
  27.  
  28.  
  29.  
  30.  
  31. System.InvalidOperationException
  32. ExecuteReader requires an open and available Connection. The connection's current state is closed.
  33.  
  34. System.Data.Entity.Core.EntityCommandExecutionException: An error occurred while executing the command definition. See the inner exception for details. ---> System.InvalidOperationException: ExecuteReader requires an open and available Connection. The connection's current state is closed.
  35. at System.Data.SqlClient.SqlCommand.ValidateCommand(String method, Boolean async)
  36. at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean asyncWrite)
  37. at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
  38. at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
  39. at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
  40. at Glimpse.Ado.AlternateType.GlimpseDbCommand.ExecuteDbDataReader(CommandBehavior behavior)
  41. at System.Data.Entity.Infrastructure.Interception.InternalDispatcher`1.Dispatch[TTarget,TInterceptionContext,TResult](TTarget target, Func`3 operation, TInterceptionContext interceptionContext, Action`3 executing, Action`3 executed)
  42. at System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.Reader(DbCommand command, DbCommandInterceptionContext interceptionContext)
  43. at System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior)
  44. --- End of inner exception stack trace ---
  45. at System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior)
  46. at System.Data.Entity.Core.Objects.Internal.ObjectQueryExecutionPlan.Execute[TResultType](ObjectContext context, ObjectParameterCollection parameterValues)
  47. at System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction[T](Func`1 func, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction, Boolean releaseConnectionOnSuccess)
  48. at System.Data.Entity.Core.Objects.ObjectQuery`1.<>c__DisplayClass7.<GetResults>b__5()
  49. at System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute[TResult](Func`1 operation)
  50. at System.Data.Entity.Core.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption)
  51. at System.Data.Entity.Core.Objects.ObjectQuery`1.<System.Collections.Generic.IEnumerable<T>.GetEnumerator>b__0()
  52. at System.Data.Entity.Internal.LazyEnumerator`1.MoveNext()
  53. at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
  54. at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
  55. at Nop.Services.Seo.FriendlyUrlService.<>c__DisplayClass5.<GetFriendlyUrlString>b__4() in ...\Libraries\Nop.Services\Seo\FriendlyUrlService.cs:line 48
  56.  
  57.  
  58.  
  59.  
  60. System.ObjectDisposedException: The ObjectContext instance has been disposed and can no longer be used for operations that require a connection.
  61. at System.Data.Entity.Core.Objects.ObjectContext.ReleaseConnection()
  62. at System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction[T](Func`1 func, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction, Boolean releaseConnectionOnSuccess)
  63. at System.Data.Entity.Core.Objects.ObjectQuery`1.<>c__DisplayClass7.<GetResults>b__5()
  64. at System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute[TResult](Func`1 operation)
  65. at System.Data.Entity.Core.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption)
  66. at System.Data.Entity.Core.Objects.ObjectQuery`1.<System.Collections.Generic.IEnumerable<T>.GetEnumerator>b__0()
  67. at System.Data.Entity.Internal.LazyEnumerator`1.MoveNext()
  68. at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
  69. at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
  70. at Nop.Services.Seo.FriendlyUrlService.<>c__DisplayClass5.<GetFriendlyUrlString>b__4() in ...\Libraries\Nop.Services\Seo\FriendlyUrlService.cs:line 48
  71.  
  72.  
  73.  
  74.  
  75. System.NullReferenceException: Object reference not set to an instance of an object.
  76. at System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry)
  77. at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)
  78. at System.Data.SqlClient.SqlConnection.Open()
  79. at System.Data.Entity.Infrastructure.Interception.InternalDispatcher`1.Dispatch[TTarget,TInterceptionContext](TTarget target, Action`2 operation, TInterceptionContext interceptionContext, Action`3 executing, Action`3 executed)
  80. at System.Data.Entity.Infrastructure.Interception.DbConnectionDispatcher.Open(DbConnection connection, DbInterceptionContext interceptionContext)
  81. at System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.<>c__DisplayClass1.<Execute>b__0()
  82. at System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute[TResult](Func`1 operation)
  83. at System.Data.Entity.Core.EntityClient.EntityConnection.Open()
  84. at System.Data.Entity.Core.Objects.ObjectContext.EnsureConnection(Boolean shouldMonitorTransactions)
  85. at System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction[T](Func`1 func, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction, Boolean releaseConnectionOnSuccess)
  86. at System.Data.Entity.Core.Objects.ObjectQuery`1.<>c__DisplayClass7.<GetResults>b__5()
  87. at System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute[TResult](Func`1 operation)
  88. at System.Data.Entity.Core.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption)
  89. at System.Data.Entity.Core.Objects.ObjectQuery`1.<System.Collections.Generic.IEnumerable<T>.GetEnumerator>b__0()
  90. at System.Data.Entity.Internal.LazyEnumerator`1.MoveNext()
  91. at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
  92. at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
  93. at Nop.Services.Seo.FriendlyUrlService.<>c__DisplayClass5.<GetFriendlyUrlString>b__4() in ...\Libraries\Nop.Services\Seo\FriendlyUrlService.cs:line 48
  94.  
  95.  
  96.  
  97. System.ArgumentException
  98. An item with the same key has already been added.
  99.  
  100. System.ArgumentException: An item with the same key has already been added.
  101. at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
  102. at System.Data.Entity.Internal.InternalContext.Set[TEntity]()
  103. at System.Data.Entity.DbContext.Set[TEntity]()
  104. at Nop.Data.NopObjectContext.Set[TEntity]() in ...\Libraries\Nop.Data\NopObjectContext.cs:line 106
  105. at Nop.Data.EfRepository`1.get_Entities() in ...\Libraries\Nop.Data\EfRepository.cs:line 136
  106. at Nop.Data.EfRepository`1.get_ReadOnlyTable() in ...\Libraries\Nop.Data\EfRepository.cs:line 120
  107. at Nop.Services.Seo.FriendlyUrlService.<>c__DisplayClass5.<GetFriendlyUrlString>b__4() in ...\Libraries\Nop.Services\Seo\FriendlyUrlService.cs:line 48
  108. at Nop.Core.Caching.CacheExtensions.Get[T](ICacheManager cacheManager, String key, Int32 cacheTime, Func`1 acquire) in ...\Libraries\Nop.Core\Caching\Extensions.cs:line 22
  109. at Nop.Services.Seo.FriendlyUrlService.GetFriendlyUrlString(String originalUrl) in ...\Libraries\Nop.Services\Seo\FriendlyUrlService.cs:line 52
  110. at Site.Infrastructure.CatalogRoute.GetRouteData(HttpContextBase httpContext) in ...\Infrastructure\CatalogRoute.cs:line 46
  111. at Castle.Proxies.Invocations.Route_GetRouteData_1.InvokeMethodOnTarget()
  112. at Castle.DynamicProxy.AbstractInvocation.Proceed()
  113. at Glimpse.Core.Extensibility.AlternateMethod.NewImplementation(IAlternateMethodContext context)
  114. at Castle.DynamicProxy.AbstractInvocation.Proceed()
  115. at Castle.Proxies.RouteProxy_1.GetRouteData(HttpContextBase httpContext)
  116. at System.Web.Routing.RouteCollection.GetRouteData(HttpContextBase httpContext)
  117. at System.Web.Routing.UrlRoutingModule.PostResolveRequestCache(HttpContextBase context)
  118. at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
  119. at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
Advertisement
Add Comment
Please, Sign In to add comment