Я видел похожие вопросы на inte rnet, но решение не помогает.
Я работаю над веб-формами.
Установленные SignalR 2.2.2 и jQuery 3.3.1.
мой скрипт
<script src='<%: ResolveClientUrl("/Scripts/jquery-3.3.1.min.js") %>'></script>
<script src='<%: ResolveClientUrl("/Scripts/jquery.signalR-2.2.2.min.js") %>'></script>
<script src="/signalr/hubs"></script>
<script type="text/javascript">
$(function () {
// Declare a proxy to reference the hub.
var alpha = $.connection.alphaHub;
// Create a function that the hub can call to broadcast messages.
alpha.client.broadcastMessage = function (message) {
alert(message);
//// Html encode display name and message.
//var encodedName = $('<div />').text(name).html();
//var encodedMsg = $('<div />').text(message).html();
//// Add the message to the page.
//$('#discussion').append('<li><strong>' + encodedName
// + '</strong>: ' + encodedMsg + '</li>');
};
// Start the connection.
$.connection.hub.start().done(function () {
$('#sendmessage').click(function () {
// Call the Send method on the hub.
alpha.server.display($("parameters here"));
});
});
});
</script>
Ошибка заключается в следующем
localhost: 8888 / signalr / концентраторы не найдены
Startup.cs (в том же каталоге, что и файл Default.aspx)
public class Startup
{
public void Configuration(IAppBuilder app)
{
app.MapSignalR();
}
}
Класс концентратора
public class AlphaHub : Hub
{
public void Display(string name, string message)
{
Clients.All.broadcastMessage(name, message);
}
}
Я тестировал тот же код. Построил отдельный проект и он там работал. Проблема в моем текущем проекте.