0
carelearning created
Dear Volosoft Representative,
Steps to reproduce:
- Clone latest AbpZero github
- Configure The Project
- Create sample Tenant demo
- Create one user jdoe for new Tenant demo
- Create new controller Test under MPA area.
- Create new Index view for Test controller.
- Create Hubs folder in root of Web project
- Create ManagementHub under Hubs folder. Code
- Login and navigate /mpa/test/index
- Check app_data\logs\logs.txt Expected messages are not appearing
ManagementHub.cs
namespace MyCompanyName.AbpZeroTemplate.Web.Hubs
{
using Abp.Dependency;
using Abp.Runtime.Session;
using Castle.Core.Logging;
using Microsoft.AspNet.SignalR;
using Microsoft.AspNet.SignalR.Hubs;
using System.Threading.Tasks;
[HubName("management")]
public class ManagementHub: Hub, ITransientDependency
{
public IAbpSession AbpSession { get; set; }
public ILogger Logger { get; set; }
public ManagementHub()
{
AbpSession = NullAbpSession.Instance;
Logger = NullLogger.Instance;
}
public override Task OnConnected()
{
await base.OnConnected();
Logger.Debug($"A client connected to ManagementHub: {Context.ConnectionId}.");
return Task.FromResult(0);
}
public override Task OnDisconnected(bool stopCalled)
{
await base.OnDisconnected(stopCalled);
Logger.Debug($"A client disconnected to ManagementHub: {Context.ConnectionId}.");
return Task.FromResult(0);
}
}
}
TestController.cs
using System.Web.Mvc;
namespace MyCompanyName.AbpZeroTemplate.Web.Areas.Mpa.Controllers
{
public class TestController : Controller
{
// GET: Mpa/Test
public ActionResult Index()
{
return View("Index");
}
}
}
Index.cshtml
@{
ViewBag.Title = "title";
}
<h2>Welcome to TEST</h2>
1 Answer(s)
-
0
We worked around the issue by extracting functionality into two separate hub classes and registered them independently.
We changed our IOC registrations in AbpZeroTemplateWebModule in PreInitialize from:
Old Way
IocManager.IocContainer.Register( Component.For<IMessage<string>, IStatusMessage>() .ImplementedBy<ManagementHub>() .LifestyleSingleton() );
New Way
IocManager.Register<IMessage, ManagementHub>(); IocManager.Register<IStatusMessage, AgentHub>();
The AgentHub's OnConnected and OnDisconnected is not firing, however the ManagementHub now is. This works for our needs.