Dieses Blog durchsuchen

Donnerstag, 28. März 2019

A route named 'DefaultApi' is already in the route collection. Route names must be unique.

Problem:

A route named 'DefaultApi' is already in the route collection. Route names must be unique.
Parameter name: name

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.

Exception Details: System.ArgumentException: A route named 'DefaultApi' is already in the route collection. Route names must be unique.
Parameter name: name

Source Error:


Line 24:         public static void Register(HttpConfiguration config)
Line 25:         {
Line 26:             config.Routes.MapHttpRoute(
Line 27:                 name: "DefaultApi",
Line 28:                 routeTemplate: "api/{controller}/{action}/{id}",

Source File: D:\Source\be\src\Foundation\Api\code\App_Start\WebApiConfig.cs    Line: 26

Stack Trace:


[ArgumentException: A route named 'DefaultApi' is already in the route collection. Route names must be unique.
Parameter name: name]
   System.Web.Routing.RouteCollection.Add(String name, RouteBase item) +391

   System.Web.Http.HttpRouteCollectionExtensions.MapHttpRoute(HttpRouteCollection routes, String name, String routeTemplate, Object defaults) +21
   Infocentric.Sc.Foundation.Api.WebApiConfig.Register(HttpConfiguration config) in WebApiConfig.cs:26
   Infocentric.Sc.Foundation.Api.WebApiConfig.Start() in WebApiConfig.cs:19

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
   System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) +0
   System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) +260
   System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +142
   WebActivatorEx.BaseActivationMethodAttribute.InvokeMethod() +81
   WebActivatorEx.ActivationManager.RunActivationMethods(Boolean designerMode) +699
   WebActivatorEx.StartMethodCallingModule.Init(HttpApplication context) +122
   System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +581
   System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +168
   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +277
   System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +369

[HttpException (0x80004005): Exception has been thrown by the target of an invocation.]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +532
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +111
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +714


Solution:

I renamed the namespaces without removing associated bin and output files. Manually delete the bin and obj folders from the output directory. Rebuild or cleaning the solution is not enough.

Sitecore Method not found: 'Void SolrNet.Impl.SolrMoreLikeThis


Problem:

Method not found: 'Void SolrNet.Impl.SolrMoreLikeThisHandlerQueryResultsParser`1..ctor(System.Collections.Generic.IEnumerable`1<SolrNet.Impl.ISolrAbstractResponseParser`1<System.__Canon>>)'.

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.

Exception Details: System.MissingMethodException: Method not found: 'Void SolrNet.Impl.SolrMoreLikeThisHandlerQueryResultsParser`1..ctor(System.Collections.Generic.IEnumerable`1<SolrNet.Impl.ISolrAbstractResponseParser`1<System.__Canon>>)'.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[MissingMethodException: Method not found: 'Void SolrNet.Impl.SolrMoreLikeThisHandlerQueryResultsParser`1..ctor(System.Collections.Generic.IEnumerable`1
   Sitecore.ContentSearch.SolrProvider.SolrNetIntegration.DefaultSolrLocator`1..ctor() +0

   Sitecore.ContentSearch.SolrProvider.Pipelines.Loader.InitializeSolrProvider.Process(PipelineArgs args) +209
   (Object , Object ) +9
   Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args) +484
   Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain, Boolean failIfNotExists) +236
   Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain) +22
   Sitecore.Nexus.Web.HttpModule.Application_Start() +215
   Sitecore.Nexus.Web.HttpModule.Init(HttpApplication app) +1184
   System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +581
   System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +168
   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +277
   System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +369


   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +532
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +111
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +714






Solution:

- I found a SolrNet.xml in Website/bin whitch had those bad refererences. Well there was is hardcoded SolrNet.dll. I removed that an pulled the lastest Version of Solr via nuget. Than it worked fine.