Base solution for your next web application

Activities of "phoenix"

Thanks to Halil, the problem was solved:

[DependsOn(typeof(REPDataModule))]
public class MyConsoleModule : AbpModule
{
   public override void Initialize()
   {
      IocManager.RegisterAssemblyByConvention(Assembly.GetExecutingAssembly());
   }
}
public class Program
{
   public static void Main()
   {
      using(var bootstrapper = new AbpBootstrapper())
      {
         bootstrapper.Initialize();
         var config = new JobHostConfiguration()
         {
            JobActivator = new JobActivator(bootstrapper.IocManager.IocContainer)
         };
         if (config.IsDevelopment)
         {
            config.UseDevelopmentSettings();
         }
         JobHost host = new JobHost(config);
         host.RunAndBlock();
      }
   }
}

I am trying to configure dependency injection for azure web job using IoCManager. For example, I want to inject IRepository<Currency>.

I have done the following:

public class JobActivator : IJobActivator
{
   private readonly IWindsorContainer _container;
   public JobActivator()
   {
      _container = IocManager.Instance.IocContainer;
   }
   public T CreateInstance<T>()
   {
      return _container.Resolve<T>();
   }
}
public class Program
{
   public static void Main()
   {
      var config = new JobHostConfiguration()
      {
         JobActivator = new JobActivator()
      };
      JobHost host = new JobHost(config);
      host.RunAndBlock();
   }
}
public class Functions
{
   private readonly IRepository<Currency> _currencyRepository;
   public Functions(IRepository<Currency> currencyRepository)
   {
      _currencyRepository = currencyRepository;
   }
   public void ProcessQueueMessage([QueueTrigger("BuyerProfileQueue")] JobMessage message)
   {
      Currency currency = _currencyRepository.Get(1);
   }
}

When job triggers, I have the following exception: Castle.MicroKernel.ComponentNotFoundException: No component for supporting the service was found Any help would be greatly appreciated Pavel

Thank you, solved. The problem was related with business logic of the application and had nothing to do with ABP or SignalR.

That should fix that issue:

.ui-grid-render-container-body {
   position: relative;
}

.ui-grid-cell-contents div.btn-group {
   position: absolute !important;
}

<cite>ismcagdas: </cite>

Hi, 1 ) is there any other code after app.MapSignalR(); in your Startup.cs's configure method ?

No.

<cite>ismcagdas: </cite>

  1. Is there any other tab/browser window opened with the same account. Because for your version (Abp 0.8.4), the notification will be sent to only last opened browser window/tab.

No.

<cite>ismcagdas: </cite> Hi, Which version of ABP do you use ? I remember a similar issue in the one of previous versions.

0.8.4.0

<cite>hikalkan: </cite> Have you registered to the "App.SimpleMessage" notification from the current user? <a class="postlink" href="http://www.aspnetboilerplate.com/Pages/Documents/Notification-System#subscribe-to-notifications">http://www.aspnetboilerplate.com/Pages/ ... ifications</a>

Yes, I had.

await _notificationSubscriptionManager.IsSubscribedAsync(recepient.Id, "App.SimpleMessage");

returns true.

Good day,

I am trying to push notifications from server to client side using abp notification system.

My StartUp.cs:

public class Startup
{
   public void Configuration(IAppBuilder app)
   {
      ...
      app.MapSignalR();
   }
}

My Web Service:

public class ContactFormsAppService : REPAppServiceBase, IContactFormsAppService
{
   private readonly IAppNotifier _appNotifier;
   public ContactFormsAppService(IAppNotifier appNotifier)
   {
      _appNotifier = appNotifier;
   }
   public void SendMessageForOffice()
   {
      _appNotifier.SendMessage(101, "Message");
   }
}

AppNotifier:

public class AppNotifier : REPDomainServiceBase, IAppNotifier
{
   private readonly INotificationPublisher _notificationPublisher;
   public AppNotifier(INotificationPublisher notificationPublisher)
   {
      _notificationPublisher = notificationPublisher;
   }
   public async Task SendMessage(long userId, string message, NotificationSeverity severity = NotificationSeverity.Info)
   {
        await _notificationPublisher.PublishAsync(
             "App.SimpleMessage", 
             new MessageNotificationData(message),  
             severity: severity, 
             userIds: new[] { userId } );
    }
}

I can see messages in debugger console in the browser:

abp.js:285 DEBUG: abp.js:285 Connected to SignalR server! abp.js:285 DEBUG: abp.js:285 Registered to the SignalR server!

However, the event in header.js is never fired:

abp.event.on('abp.notifications.received', function (userNotification) {
   console.log("notification!", userNotification);
});

Any help would be greatly appreciated.

Answer

So the default route's that came with aspNetBoilerPlate are

routes.MapHttpRoute( name: "DefaultApi", routeTemplate: "api/{controller}/{id}", defaults: new { id = RouteParameter.Optional } );

routes.MapRoute( name: "Default", url: "{controller}/{action}/{id}", defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }, namespaces: new[] { "REP.Regional.Controllers" } );


When I add shortlink at the end and it will never trigger routes.MapRoute( name: "ShortLinks", url: "{name}", defaults: new { controller = "ShortLink", action = "Index", name = UrlParameter.Optional } );

If i add short link route in the middle of the route's it will loop indefinitely.

My ShortLinkController code is basic public ActionResult Index(string name) { return Redirect("/application#/listing/123"); }

I did try that, and my route's doesn't work right. The only way I got around this was by adding a delimeter /sl/ in the url. However my requirement dictates that I cannot have that key delimeter. The only thing I know is that the application#/listing can be pre-defined in the route.

So the default route's that came with aspNetBoilerPlate are

routes.MapHttpRoute( name: "DefaultApi", routeTemplate: "api/{controller}/{id}", defaults: new { id = RouteParameter.Optional } );

        routes.MapRoute(
            name: "Default",
            url: "{controller}/{action}/{id}",
            defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional },
            namespaces: new[] { "REP.Regional.Controllers" }
            );

When I add shortlink at the end and it will never trigger routes.MapRoute( name: "ShortLinks", url: "{name}", defaults: new { controller = "ShortLink", action = "Index", name = UrlParameter.Optional } );

If i add short link route in the middle of the route's it will loop indefinitely.

My ShortLinkController code is basic public ActionResult Index(string name) { if (!string.IsNullOrEmpty(name)) { ListResultOutput<ShortLinkListDto> shortLinks = AsyncHelper.RunSync(() => _shortlinkAppService.GetShortLinks(new GetShortLinkInput() { TenantFilter = 1, RegionFilter = 2004 })); ShortLinkListDto shortLink = shortLinks.Items.Where(e => e.Link.Trim().ToLower() == name.ToLower().Trim()).FirstOrDefault(); if (shortLink != null) { return Redirect(shortLink.FullLink); //this will redirect to /application#/listing/123 } } return Redirect("/"); }

Hi,

Could someone please assist in my need to create a route that will handle all my short links without breaking the Signal R / Angular JS front end architecture?

What I need is e.g. host/shortlink1 should redirect to host/applicaiton#/listing/123

The /application#/object is be pre-defined or determined.

Showing 1 to 10 of 12 entries