Sitecore 8.2 error when adding Placeholder - asp.net

I am almost completely new to Sitecore and I was about to try out adding a controller rendering to a demo page I am creating.
I have a main page, with a placeholder for the controller rendering. Placeholder is added to the presentation details of my main page item and accepts the rendering.
When I now go to the experience editor and try to add the controller rendering to the page I get this
Error Rendering Controller: SitecoreDemo.Controllers.FoodFinder.PlacesToEatListController, SitecoreDemo. Action: Index: An unhandled exception occurred.
at Sitecore.Mvc.Pipelines.MvcEvents.Exception.ShowAspNetErrorMessage.ShowErrorMessage(ExceptionContext exceptionContext, ExceptionArgs args)
at Sitecore.Mvc.Pipelines.MvcEvents.Exception.ShowAspNetErrorMessage.Process(ExceptionArgs args)
at (Object , Object[] )
at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args)
at Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain)
at Sitecore.Mvc.Pipelines.PipelineService.RunPipeline[TArgs](String pipelineName, TArgs args)
at Sitecore.Mvc.Filters.PipelineBasedRequestFilter.OnException(ExceptionContext exceptionContext)
at System.Web.Mvc.ControllerActionInvoker.InvokeExceptionFilters(ControllerContext controllerContext, IList`1 filters, Exception exception)
at System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName)
at System.Web.Mvc.Controller.ExecuteCore()
at System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext)
at Sitecore.Mvc.Controllers.ControllerRunner.ExecuteController(Controller controller)
at Sitecore.Mvc.Controllers.ControllerRunner.Execute()
at Sitecore.Mvc.Presentation.ControllerRenderer.Render(TextWriter writer)
at Sitecore.Mvc.Pipelines.Response.RenderRendering.ExecuteRenderer.Render(Renderer renderer, TextWriter writer, RenderRenderingArgs args)
I think this isn't even the full stacktrace but I only see this little box on the page and I don't know how I could even get to the full exception message...

The issue Might be because of the dll referencing the Controller was not in the bin folder. So, please make sure that the assembly referencing the Controller is in the bin folder.
Also, even if the dll is in the bin folder, it may be that it is not being overwritten with the new one. You may try to copy and paste the dll into the bin folder.

Problem was caused by putting the view in the wrong place. If returning a view by convention it's always Views\\.cshtml no matter where the controller is located.
My views were mirroring the namespace structure of the controller which caused ASP.NET MVC to fail finding it by convention (return View(model))

Related

Adding an additional assembly to App.razor router in Blazor causes _Host.cshtml to throw 'Object reference not set to an instance of an object'

I have a Razor Class Library (RCL) that contains both Razor components and pages. This RCL has a folder named "Pages" which contains an Index.razor page and one named Details.razor. I have added the RCL to a Blazor Server project, referenced it, and am trying to let the router in the host project know where to find the Details.razor page (the host project already contains an Index page and will not use the RCL version). Here is my router code from App.razor:
<Router AppAssembly="#typeof(App).Assembly"
AdditionalAssemblies="new[] {
typeof(MyRcl.Pages.Details).Assembly
}">
<Found Context="routeData">
<RouteView RouteData="#routeData" DefaultLayout="#typeof(MainLayout)" />
<FocusOnNavigate RouteData="#routeData" Selector="h1" />
</Found>
<NotFound>
<PageTitle>Not found</PageTitle>
<LayoutView Layout="#typeof(MainLayout)">
<p role="alert">Sorry, there's nothing at this address.</p>
</LayoutView>
</NotFound>
</Router>
Building the project throws the following exception from the last line of the _Host.cshtml file:
#page "/"
#namespace MyProject.Pages
#addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
#{
Layout = "_Layout";
}
<component type="typeof(App)" render-mode="ServerPrerendered" />
System.NullReferenceException: 'Object reference not set to an instance of an object.'
Call stack:
>
MyProject.dll!MyProject.Pages.Pages__Host.ExecuteAsync() Line 8 C#
Microsoft.AspNetCore.Mvc.RazorPages.dll!Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.RazorPageAdapter.ExecuteAsync() Unknown
Microsoft.AspNetCore.Mvc.Razor.dll!Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageCoreAsync(Microsoft.AspNetCore.Mvc.Razor.IRazorPage page, Microsoft.AspNetCore.Mvc.Rendering.ViewContext context) Unknown
Microsoft.AspNetCore.Mvc.Razor.dll!Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageAsync(Microsoft.AspNetCore.Mvc.Razor.IRazorPage page, Microsoft.AspNetCore.Mvc.Rendering.ViewContext context, bool invokeViewStarts) Unknown
Microsoft.AspNetCore.Mvc.Razor.dll!Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderAsync(Microsoft.AspNetCore.Mvc.Rendering.ViewContext context) Unknown
Microsoft.AspNetCore.Mvc.ViewFeatures.dll!Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor.ExecuteAsync(Microsoft.AspNetCore.Mvc.Rendering.ViewContext viewContext, string contentType, int? statusCode) Unknown
Microsoft.AspNetCore.Mvc.RazorPages.dll!Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageResultExecutor.ExecuteAsync(Microsoft.AspNetCore.Mvc.RazorPages.PageContext pageContext, Microsoft.AspNetCore.Mvc.RazorPages.PageResult result) Unknown
Microsoft.AspNetCore.Mvc.RazorPages.dll!Microsoft.AspNetCore.Mvc.RazorPages.PageResult.ExecuteResultAsync(Microsoft.AspNetCore.Mvc.ActionContext context) Unknown
Microsoft.AspNetCore.Mvc.Core.dll!Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeResultAsync(Microsoft.AspNetCore.Mvc.IActionResult result) Unknown
Microsoft.AspNetCore.Mvc.RazorPages.dll!Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.InvokeResultAsync(Microsoft.AspNetCore.Mvc.IActionResult result) Unknown
Microsoft.AspNetCore.Mvc.Core.dll!Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.ResultNext<Microsoft.AspNetCore.Mvc.Filters.IResultFilter, Microsoft.AspNetCore.Mvc.Filters.IAsyncResultFilter>(ref Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.State next, ref Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Scope scope, ref object state, ref bool isCompleted) Unknown
Microsoft.AspNetCore.Mvc.Core.dll!Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeNextResultFilterAsync<Microsoft.AspNetCore.Mvc.Filters.IResultFilter, Microsoft.AspNetCore.Mvc.Filters.IAsyncResultFilter>() Unknown
Microsoft.AspNetCore.Mvc.Core.dll!Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.ResultNext<Microsoft.AspNetCore.Mvc.Filters.IResultFilter, Microsoft.AspNetCore.Mvc.Filters.IAsyncResultFilter>(ref Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.State next, ref Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Scope scope, ref object state, ref bool isCompleted) Unknown
Microsoft.AspNetCore.Mvc.Core.dll!Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeResultFilters() Unknown
Microsoft.AspNetCore.Mvc.Core.dll!Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(ref Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.State next, ref Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Scope scope, ref object state, ref bool isCompleted) Unknown
Microsoft.AspNetCore.Mvc.Core.dll!Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeNextResourceFilter() Unknown
Microsoft.AspNetCore.Mvc.Core.dll!Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(ref Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.State next, ref Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Scope scope, ref object state, ref bool isCompleted) Unknown
Microsoft.AspNetCore.Mvc.Core.dll!Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync() Unknown
Microsoft.AspNetCore.Mvc.Core.dll!Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeAsync() Unknown
Microsoft.AspNetCore.Mvc.RazorPages.dll!Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageRequestDelegateFactory.CreateRequestDelegate.AnonymousMethod__0(Microsoft.AspNetCore.Http.HttpContext context) Unknown
Microsoft.AspNetCore.Routing.dll!Microsoft.AspNetCore.Routing.EndpointMiddleware.Invoke(Microsoft.AspNetCore.Http.HttpContext httpContext) Unknown
Microsoft.AspNetCore.Routing.dll!Microsoft.AspNetCore.Routing.EndpointRoutingMiddleware.Invoke(Microsoft.AspNetCore.Http.HttpContext httpContext) Unknown
Microsoft.AspNetCore.StaticFiles.dll!Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(Microsoft.AspNetCore.Http.HttpContext context) Unknown
Microsoft.AspNetCore.HttpsPolicy.dll!Microsoft.AspNetCore.HttpsPolicy.HttpsRedirectionMiddleware.Invoke(Microsoft.AspNetCore.Http.HttpContext context) Unknown
Microsoft.AspNetCore.HttpsPolicy.dll!Microsoft.AspNetCore.HttpsPolicy.HstsMiddleware.Invoke(Microsoft.AspNetCore.Http.HttpContext context) Unknown
Microsoft.AspNetCore.Diagnostics.dll!Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(Microsoft.AspNetCore.Http.HttpContext context) Unknown
Microsoft.AspNetCore.Diagnostics.dll!Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(Microsoft.AspNetCore.Http.HttpContext context) Unknown
Microsoft.AspNetCore.HostFiltering.dll!Microsoft.AspNetCore.HostFiltering.HostFilteringMiddleware.Invoke(Microsoft.AspNetCore.Http.HttpContext context) Unknown
Microsoft.WebTools.BrowserLink.Net.dll!Microsoft.WebTools.BrowserLink.Net.BrowserLinkMiddleware.ExecuteWithFilterAsync(Microsoft.WebTools.BrowserLink.Net.IHttpSocketAdapter injectScriptSocket, string requestId, Microsoft.AspNetCore.Http.HttpContext httpContext) Unknown
Microsoft.WebTools.BrowserLink.Net.dll!Microsoft.WebTools.BrowserLink.Net.BrowserLinkMiddleware.InvokeAsync(Microsoft.AspNetCore.Http.HttpContext context) Unknown
Microsoft.AspNetCore.Watch.BrowserRefresh.dll!Microsoft.AspNetCore.Watch.BrowserRefresh.BrowserRefreshMiddleware.InvokeAsync(Microsoft.AspNetCore.Http.HttpContext context) Unknown
Microsoft.AspNetCore.Http.Abstractions.dll!Microsoft.AspNetCore.Builder.Extensions.MapWhenMiddleware.Invoke(Microsoft.AspNetCore.Http.HttpContext context) Unknown
Microsoft.AspNetCore.Hosting.dll!Microsoft.AspNetCore.Hosting.HostingApplication.ProcessRequestAsync(Microsoft.AspNetCore.Hosting.HostingApplication.Context context) Unknown
Microsoft.AspNetCore.Server.Kestrel.Core.dll!Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests<Microsoft.AspNetCore.Hosting.HostingApplication.Context>(Microsoft.AspNetCore.Hosting.Server.IHttpApplication<Microsoft.AspNetCore.Hosting.HostingApplication.Context> application) Unknown
Microsoft.AspNetCore.Server.Kestrel.Core.dll!Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequestsAsync<Microsoft.AspNetCore.Hosting.HostingApplication.Context>(Microsoft.AspNetCore.Hosting.Server.IHttpApplication<Microsoft.AspNetCore.Hosting.HostingApplication.Context> application) Unknown
Microsoft.AspNetCore.Server.Kestrel.Core.dll!Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2.Http2Stream<Microsoft.AspNetCore.Hosting.HostingApplication.Context>.Execute() Unknown
System.Private.CoreLib.dll!System.Threading.ThreadPoolWorkQueue.Dispatch() Unknown
System.Private.CoreLib.dll!System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart() Unknown
System.Private.CoreLib.dll!System.Threading.Thread.StartCallback() Unknown
If I remove the "AdditionalAssemblies" statement from the router configuration the app builds and runs fine, so I am pretty sure that is triggering the error but am unsure on what is causing it (I have double-checked the syntax and compared it with other apps where I have consumed Razor pages from RCLs and the code seems correct). Any help or ideas for further clarifying what the underlying problem might be is appreciated.
Found the issue - will post here in case someone else encounters the same problem as is difficult to identify. It is a variation of a .NET 6 issue described here and here which is slotted for consideration in .NET 7. In my case the issue was the duplicate Index.razor files in the host project and RCL (not the Details.razor file I was trying to consume from the RCL). The duplicate files should not be an issue per MS documentation as the file in the hosting app should take precedence. This was indeed the case until I tried to modify App.razor to consume the Details page from the RCL, at which point the exception occurs (even though I am only referencing the unduplicated Details page and not the Index page in the router code). I can resolve the exception by removing the unused Index page in the RCL (but this is not a permanent solution as it is used in other projects). My workaround for now is to override both of the RCL pages and remove the AdditionalAssemblies statement from App.razor.

ASP.NET Framework web app setting contract to null when file is "large"

I have an ASP.NET framework web application that processes documents and returns it in a template contract. If I send it a smaller document (143KB) it processes fine and sets the template contract properly (ie. template contract is not null):
Template set properly for smaller file
If I try a larger file (5MB), it receives the request but the template contract is null:
Template contract set to null for larger file
This is the code where the template object is recieved:
[Route("v2/document")]
[HttpPost]
public IHttpActionResult ReportsV2([FromBody] Template template)
{
if (template.Data == null && string.IsNullOrEmpty(template.ConnectionString))
{
if (Log.IsDebugEnabled)
{
LogDebugHeaders();
LogRawIncomingContent();
}
throw new ReportGeneratorException("Template not provided. Specify the Data or Uri element.");
}
So when I use the larger file it hits the conditional statement and throws an error.
Ive also added the following lines to the following lines to the web.config but still got the error:
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="2147483648" />
</requestFiltering>
</security>
This is the exception I get:
System.NullReferenceException
HResult=0x80004003
Message=Object reference not set to an instance of an object.
Source=RESTfulEngine
StackTrace:
at RESTfulEngine.Controllers.ReportsController.ReportsV2(Template template) in C:\Jenova\restfulengine\RESTfulEngine\Controllers\ReportsController.cs:line 95
at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass6_2.<GetExecutor>b__2(Object instance, Object[] methodParameters)
at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.Execute(Object instance, Object[] arguments)
at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)
Any ideas as to why this is happening?

Upgrade to Prism 8 is causing navigation errors

Environment
Xamarin Forms: 5.0.0.1709-pre4 (but also fails with 4.8.0.1687)
VS2019 16.8.3
XCode: 12.2
Prism NuGets
Prism.DryIoc.Extensions 8.0.48
Prism.Forms 8.0.0.1909
Prism.PluginPopups 8.0.31-beta
Shiny.Prism 8.0.48
Inner Exception from INavigationResult: DryIoc.ContainerException -> InvalidOperationException
code: Error.UnableToResolveFromRegisteredServices;
message: Unable to resolve Resolution root IRMobile.PageModels.LandingPageModel with passed arguments
[Constant(Prism.Navigation.ErrorReportingNavigationService,
typeof(Prism.Navigation.ErrorReportingNavigationService))]
from container with scope {Name=null}
with Rules with {TrackingDisposableTransients, UseDynamicRegistrationsAsFallbackOnly,
FuncAndLazyWithoutRegistration, SelectLastRegisteredFactory} and without
{ThrowOnRegisteringDisposableTransient, UseFastExpressionCompilerIfPlatformSupported}
with FactorySelector=SelectLastRegisteredFactory
with Made={FactoryMethod=ConstructorWithResolvableArguments}
with normal and dynamic registrations:
(DefaultDynamicKey(0), {FactoryID=317, ImplType=IRMobile.PageModels.LandingPageModel,
Reuse=TransientReuse, HasCondition})
Stack Trace from InnerException:
at DryIoc.Container.TryThrowUnableToResolve (DryIoc.Request request) [0x00058] in /_/src/DryIoc/Container.cs:1077
at DryIoc.Container.DryIoc.IContainer.ResolveFactory (DryIoc.Request request) [0x00072] in /_/src/DryIoc/Container.cs:1059
at DryIoc.Container.ResolveAndCacheKeyed (System.Int32 serviceTypeHash, System.Type serviceType, System.Object serviceKey, DryIoc.IfUnresolved ifUnresolved, System.Object scopeName, System.Type requiredServiceType, DryIoc.Request preResolveParent, System.Object[] args) [0x000c5] in /_/src/DryIoc/Container.cs:471
at DryIoc.Container.DryIoc.IResolver.Resolve (System.Type serviceType, System.Object serviceKey, DryIoc.IfUnresolved ifUnresolved, System.Type requiredServiceType, DryIoc.Request preResolveParent, System.Object[] args) [0x00042] in /_/src/DryIoc/Container.cs:430
at DryIoc.Resolver.Resolve (DryIoc.IResolver resolver, System.Type serviceType, System.Object[] args, DryIoc.IfUnresolved ifUnresolved, System.Type requiredServiceType, System.Object serviceKey) [0x00000] in /_/src/DryIoc/Container.cs:7809
at Prism.DryIoc.DryIocContainerExtension.Resolve (System.Type type, System.ValueTuple`2[System.Type,System.Object][] parameters) [0x0001c] in /_/external/Prism/src/Containers/Prism.DryIoc.Shared/DryIocContainerExtension.cs:294
App.xaml.cs
protected override void RegisterTypes(IContainerRegistry containerRegistry)
{
// for RgPopups
containerRegistry.RegisterPopupNavigationService();
containerRegistry.RegisterPopupDialogService();
// Essentials
containerRegistry.Register<ISecureStorage, SecureStorageImplementation>();
containerRegistry.RegisterSingleton<IAppInfo, AppInfoImplementation>();
// page stuff
containerRegistry.RegisterForNavigation<NavigationPage>();
containerRegistry.RegisterForNavigation<IconNavigationPage>();
containerRegistry.RegisterSingleton<IPageBehaviorFactory, CustomPageBehaviorFactory>();
...
// Page and model registrations
containerRegistry.RegisterForNavigation<LoginPage, LoginPageModel>();
containerRegistry.RegisterForNavigation<LandingPage, LandingPageModel>();
}
I get this exeption when trying to navigate to a root master/detail page from a LoginPage
await NavigationService.NavigateAsync("/MainPage/NavigationPage/LandingPage")
and the constructor for the LandingPage is
public LandingPageModel(INavigationService navigationService, IMapper mapper, IDialogs dialogs, IPushManager pushManager) : base(navigationService, mapper)
I am fairly new to Prism so I'm sure I am missing something, a registration or maybe a NuGet package, but I'm not sure what it would be. I commented out the Registrations for Popup as I was getting the same error, but referring to Prism.Plugin.Popups.PopupPageNavigationService
As always, thanks for any help!
It looks like you are attempting to navigate to a page called LandingPage, but you haven't told the container what LandingPage is.
Every time you want to create a new view and navigate to it, you need to register it for Navigation inside your App.Xaml.cs file;
containerRegistry.RegisterForNavigation<LandingPage, LandingPageViewModel>();
This line registers the view and its corresponding ViewModel inside the container. Once the container knows about the view, the NavigationService can resolve the view you wish to navigate to using the literal name of the view LandingPage.
Now you can call
await NavigationService.NavigateAsync("LandingPage");
//or
await NavigationService.NavigateAsync("/MainPage/NavigationPage/LandingPage")
NOTE
Prism navigation has a couple of neat tricks built into it. It is Uri based, so every time you navigate to another view, passing the name of the view in the NavigateAsync method will stack the view on top of the others. This means that if you start at the URI NavigationPage/PageA, if you then say NavigateAsync("PageB") you will end up at NavigationPage/PageA/PageB.
Additionally, including the / character at the very beginning of the NavigateAsync argument completely resets the stack. So if you navigate to /PageC from NavigationPage/PageA/PageB, this resets the stack to just PageC

Asp.Net Bundle - How to raise exception when minification fails

I'm using Asp.Net MVC 5 and the bundling and minification system from System.Web.Optimization 1.1.0.0:
bundles.Add(new ScriptBundle("~/angularLibraries").Include(
......
));
and then to render the Bundle:
#Scripts.Render("~/angularLibraries")
From time to time I manually check the state of my bundles by opening the corresponding url in the browser, and sometimes I find them with errors. Example:
/* Minification failed. Returning unminified contents.
(262,145-152): run-time error JS1019: Can't have 'break' outside of loop: break a
(40,297-304): run-time error JS1019: Can't have 'break' outside of loop: break a
*/
Because the bundling mechanism returns the unminified contents when the minification fails, I'm unaware of the error until I manually open that bundle in a browser.
How can I setup the Bundling system to raise an exception when minification fails so I can immediately be aware of the error?
Found a solution. I have created a custom class that derives from ScriptBundle and overrides the method ApplyTransforms:
public class CustomScriptBundle : ScriptBundle
{
public CustomScriptBundle(string virtualPath)
: base(virtualPath)
{
}
public CustomScriptBundle(string virtualPath, string cdnPath)
: base(virtualPath, cdnPath)
{
}
public override BundleResponse ApplyTransforms(BundleContext context, string bundleContent, IEnumerable<BundleFile> bundleFiles)
{
BundleResponse bundleResponse = base.ApplyTransforms(context, bundleContent, bundleFiles);
if (bundleResponse.Content.StartsWith("/* Minification failed. Returning unminified contents."))
ExceptionManager.LogMessage("Minification failed for following bundle: " + context.BundleVirtualPath);
return bundleResponse;
}
}
I ended up logging a message (an receiving an email notification from Elmah) and not throwing an exception because I have minification enabled by default only on production, and the app will continue working ok anyway.
If you throw an exception, you'll see it like this:
This solution is also applicable for StyleBundle.

MapHubs not needed in SignalR 1.01?

I am following the Hubs Quick Start Guide in the Signalr Wiki. I get an error in Global.asax, Application_Start on the line RouteTable.Routes.MapHubs().
A route named 'signalr.hubs' is already in the route collection. Route names must be unique.
Parameter name: name
Maybe this is not needed anymore in 1.0.1? It worked fine in 1.0. It is also mentioned in the readme.txt from NuGet that we need the MapHubs command.
System.ArgumentException was unhandled by user code Message=A route
named 'signalr.hubs' is already in the route collection. Route names
must be unique. Parameter name: name Source=System.Web
ParamName=name StackTrace:
at System.Web.Routing.RouteCollection.Add(String name, RouteBase item)
at System.Web.Routing.RouteCollectionExtensions.Add[T](RouteCollection
routes, String name, T item)
at System.Web.Routing.RouteCollectionExtensions.MapOwinPath(RouteCollection
routes, String name, String pathBase, Action`1 startup)
at System.Web.Routing.SignalRRouteExtensions.MapHubs(RouteCollection
routes, String name, String path, HubConfiguration configuration)
at System.Web.Routing.SignalRRouteExtensions.MapHubs(RouteCollection
routes, String path, HubConfiguration configuration)
at System.Web.Routing.SignalRRouteExtensions.MapHubs(RouteCollection
routes, HubConfiguration configuration)
at System.Web.Routing.SignalRRouteExtensions.MapHubs(RouteCollection
routes)
at SignalrServer.Global.Application_Start(Object sender, EventArgs e) in
C:\RC\Code\Signalr\SignalrServer\SignalrServer\Global.asax.cs:line 18
InnerException:
You need it. Looks like you're calling it twice in your app, don't do that. If you're not explicitly calling it twice then you have and older version of signalr that used to call it for you lying around somewhere in your bin folder. Delete it all and it should work.

Resources