Base solution for your next web application

Activities of "gunpal5"

Hello,

I am trying to setup Hangfire on my production environment. I have setup it according to this article: <a class="postlink" href="http://docs.hangfire.io/en/latest/deployment-to-production/making-aspnet-app-always-running.html">http://docs.hangfire.io/en/latest/deplo ... nning.html</a>

but i am getting this issue.

Failed An exception occurred during processing of a background job. 


System.MissingMethodException

No parameterless constructor defined for this object.
System.MissingMethodException: No parameterless constructor defined for this object.
   at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
   at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
   at System.Activator.CreateInstance(Type type, Boolean nonPublic)
   at System.Activator.CreateInstance(Type type)
   at Hangfire.JobActivator.SimpleJobActivatorScope.Resolve(Type type)
   at Hangfire.Server.CoreBackgroundJobPerformer.Perform(PerformContext context)
   at Hangfire.Server.BackgroundJobPerformer.<>c__DisplayClass8_0.<PerformJobWithFilters>b__0()
   at Hangfire.Server.BackgroundJobPerformer.InvokePerformFilter(IServerFilter filter, PerformingContext preContext, Func`1 continuation)
   at Hangfire.Server.BackgroundJobPerformer.PerformJobWithFilters(PerformContext context, IEnumerable`1 filters)
   at Hangfire.Server.BackgroundJobPerformer.Perform(PerformContext context)
   at Hangfire.Server.Worker.PerformJob(BackgroundProcessContext context, IStorageConnection connection, String jobId)

My background Job class is as follows:

private IBizMovMailer _bizMovMailer;
        private ISmsSender _smsSender;
        private IAppNotifier _appNotifier;
        private IRepository<VideoProject, long> _videoProjectRepository;
        private UserManager _userManager;
        public BizMovNotificationJob(IBizMovMailer bizMovMailer, ISmsSender smsSender, IAppNotifier appNotifier, IRepository<VideoProject, long> videoProjectRepository, UserManager userManager)
        {
            _bizMovMailer = bizMovMailer;
            _smsSender = smsSender;
            _appNotifier = appNotifier;
            _videoProjectRepository = videoProjectRepository;
            _userManager = userManager;

            this.LocalizationSourceName = BizMovConsts.LocalizationSourceName;
        }

        public override void Execute(BizMovNotificationJobArgs args)
        {..
...
}
}

I have tried to add AbpBootrapper in the ApplicationPreload of Hangfire, like this:

public class ApplicationPreload : System.Web.Hosting.IProcessHostPreloadClient
    {
        public void Preload(string[] parameters)
        {
            var bootstrapper = new AbpBootstrapper();


            bootstrapper.IocManager.IocContainer
                .AddFacility<LoggingFacility>(f => f.UseLog4Net()
                    .WithConfig("log4net.config")
                );

            bootstrapper.Initialize();
            HangfireBootstrapper.abpBootstrapper = bootstrapper;
            HangfireBootstrapper.Instance.Start();

        }
    }

but I am still getting the mentioned issue.

Any suggestion on this will be helpful.

Thanks, Gunpal Jain

I think, you need to clear your concepts of typescript first.

You need to add all declaration in a separate file with extension *.d.ts, and add the path of decleration file into _references.ts

here's my declaration code for abp module, I named it abp.d.ts and added to "typings/abp.d.ts"

declare module abp
{
    var appPath: string;
    var pageLoadTime: Date;
    function toAbsAppPath(path: string);    
}

Hello,

I want to assign TLDs like mynewdomain1.com to tenant site like mytenant1.myhostsite.com, and mynewdomain2.com to tenant site like mytenant2.myhostsite.com. I want to control which domain points to which tenant from host admin panel.

Is there any existing feature like that on this framework?

The solution I'm thinking of right now, is to have a table of all the domains and tenants mappings. and find the tenant id at the application startup by using domain name from Request Url.

Is there any better way to do that?

Regards, Gunpal Jain

  1. Create a folder "typescript" in your web project.
  2. add a file mytypings.d.ts (or whatever you like but with extension *.d.ts)
  3. add declarations in mytypings.d.ts
  4. add a file "_references.ts" on your project root, and add this line:
/// <reference path="typescript/mytypings.d.ts" />

make sure your Application Service Interfaces are extending IApplicationService interface. e.g.

public interface IMyAppService:IApplicationService
{
 Task SomeApplicationServiceMethod();
}

Hello,

Thank you very much.

I'm really enjoying working on this framework. This is an excellent work.

I would like to contribute on this project when I get time. I can help to write few scaffolders for application services, and angular views with typescript codes. I will do that after I finish with my current projects.

Regards, Gunpal Jain

Hello,

I have used UserId for now to avoid this issue.

This code was written in application service, which was called by a MVC controller. The controller's action method already had UoW attribute and virtual keyword. I will try to add virtual keyword to application service method too, just to try if that work or not.

Thanks, Gunpal Jain

I am getting this issue If I assign "User" Entity to my CustomEntities. It seems to be that Abp Framework is using different dbcontext than the actual Application

Is there any way to assign a User Entity to my application Entities?

var user = await userManager.GetUserByIdAsync(input.UserId);
            if (user == null)
                throw new UserFriendlyException("Invalid User Id");          

            VideoProject vp = new VideoProject();
            vp.Buyer = user;
 await videoProjectRepository.InsertAsync(vp);

            await CurrentUnitOfWork.SaveChangesAsync();
[InvalidOperationException: An entity object cannot be referenced by multiple instances of IEntityChangeTracker.]
   System.Data.Entity.Core.Objects.ObjectContext.VerifyContextForAddOrAttach(IEntityWrapper wrappedEntity) +5065205
   System.Data.Entity.Core.Objects.ObjectContext.AddSingleObject(EntitySet entitySet, IEntityWrapper wrappedEntity, String argumentName) +67
   System.Data.Entity.Core.Objects.DataClasses.RelatedEnd.AddEntityToObjectStateManager(IEntityWrapper wrappedEntity, Boolean doAttach) +44
   System.Data.Entity.Core.Objects.DataClasses.EntityReference.AddEntityToObjectStateManager(IEntityWrapper wrappedEntity, Boolean doAttach) +22
   System.Data.Entity.Core.Objects.DataClasses.RelatedEnd.AddGraphToObjectStateManager(IEntityWrapper wrappedEntity, Boolean relationshipAlreadyExists, Boolean addRelationshipAsUnchanged, Boolean doAttach) +28
   System.Data.Entity.Core.Objects.DataClasses.RelatedEnd.IncludeEntity(IEntityWrapper wrappedEntity, Boolean addRelationshipAsUnchanged, Boolean doAttach) +188
   System.Data.Entity.Core.Objects.DataClasses.EntityReference`1.Include(Boolean addRelationshipAsUnchanged, Boolean doAttach) +113
   System.Data.Entity.Core.Objects.DataClasses.RelationshipManager.AddRelatedEntitiesToObjectStateManager(Boolean doAttach) +172
   System.Data.Entity.Core.Objects.ObjectContext.AddObject(String entitySetName, Object entity) +396
   System.Data.Entity.Internal.Linq.&lt;&gt;c__DisplayClassd.&lt;Add&gt;b__c() +58
   System.Data.Entity.Internal.Linq.InternalSet`1.ActOnSet(Action action, EntityState newState, Object entity, String methodName) +160
   System.Data.Entity.Internal.Linq.InternalSet`1.Add(Object entity) +110
   System.Data.Entity.DbSet`1.Add(TEntity entity) +83
   Abp.EntityFramework.Repositories.EfRepositoryBase`3.InsertAsync(TEntity entity) in D:\Halil\GitHub\aspnetboilerplate\src\Abp.EntityFramework\EntityFramework\Repositories\EfRepositoryBaseOfTEntityAndTPrimaryKey.cs:80
   Castle.Proxies.EfRepositoryBase`3Proxy_19.InsertAsync_callback(VideoProject entity) +4
   Castle.Proxies.Invocations.EfRepositoryBase`3_InsertAsync_23.InvokeMethodOnTarget() +69
   Castle.DynamicProxy.AbstractInvocation.Proceed() +86
   Abp.Domain.Uow.UnitOfWorkInterceptor.PerformAsyncUow(IInvocation invocation, UnitOfWorkOptions options) in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Domain\Uow\UnitOfWorkInterceptor.cs:62
   Abp.Domain.Uow.UnitOfWorkInterceptor.PerformUow(IInvocation invocation, UnitOfWorkOptions options) in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Domain\Uow\UnitOfWorkInterceptor.cs:41
   Abp.Domain.Uow.UnitOfWorkInterceptor.Intercept(IInvocation invocation) in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Domain\Uow\UnitOfWorkInterceptor.cs:35
   Castle.DynamicProxy.AbstractInvocation.Proceed() +114
   Castle.Proxies.EfRepositoryBase`3Proxy_19.InsertAsync(VideoProject entity) +141
   K2Innovators.BizMov.VideoProjects.<CreateNewProjectForBuyer>d__5.MoveNext() in D:\OnlineTFS\K2Innovators\BizMov\K2Innovators.BizMov.Application\VideoProjects\VideoProjectAppService.cs:61
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +92
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +58
   System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() +28
   Abp.Threading.&lt;AwaitTaskWithPostActionAndFinallyAndGetResult&gt;d__5`1.MoveNext() in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Threading\InternalAsyncHelper.cs:120
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +92
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +58
   System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() +28
   Abp.Threading.&lt;AwaitTaskWithFinallyAndGetResult&gt;d__3`1.MoveNext() in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Threading\InternalAsyncHelper.cs:91
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +92
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +58
   System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() +28
   K2Innovators.BizMov.Web.Areas.Mpa.Controllers.&lt;GetCompletedView&gt;d__12.MoveNext() in D:\OnlineTFS\K2Innovators\BizMov\K2Innovators.BizMov.Web\Areas\Mpa\Controllers\VideoPackageListController.cs:143
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +92
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +58
   System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() +28
   Abp.Threading.<AwaitTaskWithPostActionAndFinallyAndGetResult>d__5`1.MoveNext() in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Threading\InternalAsyncHelper.cs:120
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +92
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +58
   System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() +28
   K2Innovators.BizMov.Web.Areas.Mpa.Controllers.<PaymentComplete>d__11.MoveNext() in D:\OnlineTFS\K2Innovators\BizMov\K2Innovators.BizMov.Web\Areas\Mpa\Controllers\VideoPackageListController.cs:106
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +92
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +58
   System.Runtime.CompilerServices.TaskAwaiter.GetResult() +26
   System.Threading.Tasks.TaskHelpersExtensions.ThrowIfFaulted(Task task) +42
   System.Web.Mvc.Async.TaskAsyncActionDescriptor.EndExecute(IAsyncResult asyncResult) +73
   System.Web.Mvc.Async.<>c__DisplayClass37.<BeginInvokeAsynchronousActionMethod>b__36(IAsyncResult asyncResult) +37
   System.Web.Mvc.Async.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult) +27
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +58
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +68
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) +34
   System.Web.Mvc.Async.AsyncInvocationWithFilters.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3d() +69
   System.Web.Mvc.Async.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f() +230
   System.Web.Mvc.Async.<>c__DisplayClass33.<BeginInvokeActionMethodWithFilters>b__32(IAsyncResult asyncResult) +27
   System.Web.Mvc.Async.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult) +27
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +58
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +68
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) +34
   System.Web.Mvc.Async.<>c__DisplayClass2b.<BeginInvokeAction>b__1c() +42
   System.Web.Mvc.Async.<>c__DisplayClass21.<BeginInvokeAction>b__1e(IAsyncResult asyncResult) +124
   System.Web.Mvc.Async.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult) +27
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +58
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +30
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +29
   System.Web.Mvc.Controller.<BeginExecuteCore>b__1d(IAsyncResult asyncResult, ExecuteCoreState innerState) +27
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +48
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +58
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +30
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +21
   System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +32
   Castle.Proxies.VideoPackageListControllerProxy.EndExecuteCore_callback(IAsyncResult asyncResult) +4
   Castle.Proxies.Invocations.Controller_EndExecuteCore.InvokeMethodOnTarget() +55
   Castle.DynamicProxy.AbstractInvocation.Proceed() +86
   Abp.Domain.Uow.UnitOfWorkInterceptor.Intercept(IInvocation invocation) in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Domain\Uow\UnitOfWorkInterceptor.cs:29
   Castle.DynamicProxy.AbstractInvocation.Proceed() +114
   Castle.Proxies.VideoPackageListControllerProxy.EndExecuteCore(IAsyncResult asyncResult) +142
   System.Web.Mvc.Controller.<BeginExecute>b__15(IAsyncResult asyncResult, Controller controller) +26
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +40
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +58
   Castle.Proxies.VideoPackageListControllerProxy.EndExecute_callback(IAsyncResult asyncResult) +26
   Castle.Proxies.Invocations.Controller_EndExecute.InvokeMethodOnTarget() +55
   Castle.DynamicProxy.AbstractInvocation.Proceed() +86
   Abp.Domain.Uow.UnitOfWorkInterceptor.Intercept(IInvocation invocation) in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Domain\Uow\UnitOfWorkInterceptor.cs:29
   Castle.DynamicProxy.AbstractInvocation.Proceed() +114
   Castle.Proxies.VideoPackageListControllerProxy.EndExecute(IAsyncResult asyncResult) +142
   System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) +24
   System.Web.Mvc.MvcHandler.<BeginProcessRequest>b__5(IAsyncResult asyncResult, ProcessRequestState innerState) +27
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +48
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +58
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +30
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +21
   System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +29
   System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +23
   System.Web.CallHandlerExecutionStep.OnAsyncHandlerCompletion(IAsyncResult ar) +129
Showing 21 to 28 of 28 entries