SignalR Negotiate in AspNetCore 2.2 with Angular consistently triggers a 404 error indicating page not found

I am currently using:

AspNetCore 2.2 Web Application Angular CLI: 8.3.3 Node: 10.16.0 OS: Windows 32-bit x64 Angular: 6.1.10

services.AddSignalR();
app.UseSignalR(config => {
  config.MapHub<NotificationHub>("/notify");
});
this.hubConnection.start().then(c => {
  console.log('connected');
});

View startup.cs image 1

View startup.cs image 2

Answer №1

Make sure to review your code and check if the following lines are missing:

import * as signalR from "@aspnet/signalr";

const connection = new signalR.HubConnectionBuilder()
    .withUrl("/notify")
    .build();

connection.start().catch(err => document.write(err));

Update: Rearrange your code in the following order

app.UseSignalR(routes =>
{
    routes.MapHub<CmsCoreHub>("/cmscore");
});
app.UseMvc(routes =>
{
    routes.MapRoute(
        name: "default",
        template: "{controller=Home}/{action=Index}/{id?}");
});

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Exploring IEnumerable with Arity and Generic Type Definitions

I created a class called Counter that keeps track of counts based on keys. Basically, it looks like this: public class Counter<T> { private Dictionary<T, int> counts; public void Increment(T key) { int current; bool ex ...

Steps for displaying a new event on a fullCalendar

Utilizing fullCalendar to display a list of events in the following manner: this.appointments = [{ title: "Appointment 1", date: "2020-09-06", allDay: false }, { title: "Appointment 2", date: "2020 ...

When trying to access the payload in a reducer, Typescript throws an error

I am facing an issue with my reducer in Typescript - Specifically, when trying to access the formError property in the payload within the second switch case. import actionTypes, { ActionCreatorType, ReducerType } from './types'; const initialSt ...

Leveraging external modules within Angular 2 to enhance component functionality

I have developed a custom module called ObDatePickerModule, which includes a directive. In addition, I have integrated the ObDatePickerModule into a project by including it in the dependencies section of the package.json. Now, I am importing Module A i ...

"Creating a Two-Column Layout with ASP.NET Core and Bootstrap through POST

I have been working on a simple form for testing and learning purposes. Initially, I used Scaffold New Razor Page in VS to create the form. Afterward, I attempted to modify it in order to have two columns on the create page. Despite trying various methods ...

Use of GetBytes() is restricted to binary or GUID columns

I'm in the process of building a C# application that utilizes .NET framework and a MySQL database. One of the key functionalities I need is the ability to store and retrieve images from the database using a 'Image' column with type LONGBLOB. ...

How can I retrieve the value of an ASP label that has been set using jQuery?

Currently, I am developing a web application in asp.net, and I have a label control on my .aspx page. My goal is to set the text value of this label using jQuery and then access this value in my .cs file. <asp:Label ID="lbltext" runat="server" Text=""& ...

ASP.NET experiences a loss of user context during database connections

Our ASP.NET application requires users to enter their AD credentials using Basic Authentication and ASP.NET Impersonation. Once the user's information is collected, the application attempts to connect to SQL Server using the following connection stri ...

Fetching Data from Response Headers in Angular 4.3.3 HttpClient

(Text Editor: Visual Studio Code; TypeScript Version: 2.2.1) The main objective here is to fetch the headers of the response from a request Let's consider a scenario where we make a POST request using HttpClient within a service: import { Injec ...

Having difficulty dynamically updating a button's state based on the number of elements in a list

This particular app follows the MAUI framework. Within MainPage.xaml, the XAML code looks like this: <Button x:Name="SendPhotoBtn" Text="Send Photos" SemanticProperties.Hint="Send photos to ...

Selecting a file using OpenFileDialog in C#

I'm facing a small issue - I'm not sure how to select a file and open it in the Mozilla OpenFileDialog. Initially, I utilize Selenium to open the dialog by clicking "Browse" and then I need to input a filename (I have the exact location via an E ...

generate a new canvas within an Angular 6 framework at a library

I am in the process of developing a unique Angular library that will enable image cropping using canvas. I initialized the library with "ng generate library" command, but when attempting to draw on the canvas, no results are visible. Here is the code from ...

Encountering difficulties in loading my personal components within angular2 framework

I encountered an issue while trying to load the component located at 'app/shared/lookup/lookup.component.ts' from 'app/associate/abc.component.ts' Folder Structure https://i.stack.imgur.com/sZwvK.jpg Error Message https://i.stack.img ...

Check for an existing entry point within the native library

I'm currently working on creating a cross-platform wrapper for a C library in C#. The library has multiple versions, each with different functions. In my wrapper, I aim to enable these functions if they are present. The C documentation provides guid ...

Is there a function return type that corresponds to the parameter types when the spread operator is used?

Is it possible to specify a return type for the Mixin() function below that would result in an intersection type based on the parameter types? function Mixin(...classRefs: any[]) { return merge(class {}, ...classRefs); } function merge(derived: any, ... ...

Issue arises when trying to set object members using a callback function in Typescript

I am facing a peculiar issue that I have yet to unravel. My goal is to display a textbox component in Angular 2, where you can input a message, specify a button label, and define a callback function that will be triggered upon button click. Below is the c ...

Categories for the Promise.all() function

I'm feeling lost trying to understand the differences between the request tuple return type and Promise.all(). This is driving me crazy. Any suggestions? const createPromises = async (utteranceObject: Array<string[]>): Promise<Array<[s ...

Scrolling through a Telerik MVC Grid with dynamic content

I'm currently working on removing pagination from a couple of Telerik MVC Grids that are loaded with a significant amount of data (over 5000, potentially more upon production). For smaller grids, removing the Pageable property usually does the trick a ...

``Is there a way to retrieve the response headers parameter when making an Axios get request?

How can I retrieve the csrf token from the response header of an Axios get request and use it in the header of a post request? Here's my current code: const FileApi= { list: (type:string,period:string): AxiosPromise<FilesL[]> => axios.g ...

Handling Many-to-Many Relationships in EF Core with C# Discord Bot

Recently, I've ventured into using Entity Framework Core to construct a database for Guilds (also known as Discord Servers) and Users, leveraging the Discord.NET Library. Each Guild can have multiple users, and each user can belong to numerous guilds. ...