Hi,
I am using Abp version 0.9.5.0. My application is a Single App Multiple DB SAAS .
I have a Host DB Called Host and three tenants DBs called T1, T2 and T3. I have seed for Inserting Admin Users and Default Roles and some other Initial Data, So I did run the migration tool which provided in the ABP Package, unfortunately, seed data are not inserted to Tenant DBs.
Here is the output I am getting
2017-05-25 17:52:35 | Host database: Default
2017-05-25 17:52:35 | Continue to migration for this host database and all tenan
ts..? (Y/N):
Y
2017-05-25 17:52:39 | HOST database migration started...
2017-05-25 17:52:52 | HOST database migration completed.
2017-05-25 17:52:52 | --------------------------------------------------------
2017-05-25 17:52:52 | Tenant database migration started... (1 / 2)
2017-05-25 17:52:52 | Name : T1
2017-05-25 17:52:52 | TenancyName : T1
2017-05-25 17:52:52 | Tenant Id : 3
2017-05-25 17:52:52 | Connection string : Server=localhost; Database=T1; User ID=*****;password=******;
2017-05-25 17:52:55 | Tenant database migration completed. (1 / 2)
2017-05-25 17:52:55 | --------------------------------------------------------
2017-05-25 17:52:55 | Tenant database migration started... (2 / 2)
2017-05-25 17:52:55 | Name : T2
2017-05-25 17:52:55 | TenancyName : T2
2017-05-25 17:52:55 | Tenant Id : 5
2017-05-25 17:52:55 | Connection string : Server=localhost; Database=T2; User ID=*****;password=******;
2017-05-25 17:52:58 | Tenant database migration completed. (2 / 2)
2017-05-25 17:52:58 | --------------------------------------------------------
2017-05-25 17:52:58 | All databases have been migrated.
Press ENTER to exit...
But still, data are not inserted to tenant db
Hi,
I am developing an application, In this application, we are different portals for different User Role 1.B2B 2.B2C 3.Admin Portal
Users may have the same username, email Id but with Different roles, In Login I need to check username, password, tenancy name and role. How do I do this?
Hi,
I am using " _userManager.LoginAsync(usernameOrEmailAddress, password, tenancyName);" Method to login the application, which will accept both username and email address. but my requirement is to authenticate the user only with Username and password not with Email and password, How do I do that?
Hi,
I am using " _userManager.LoginAsync(usernameOrEmailAddress, password, tenancyName);" Method to login the application, which will accept both username and email address. but my requirement is to authenticate user only with Username and password not with Email and password, How do I do that?
Hi
In my application I have a list of recurring jobs , which are taken from the data base,
What I have done is , Taken the list of recurring job details from database , Iterated it and added to hangfire recurring job, But when I do this my DB is getting locked and application crashes or a timeout exception arises .
Please have a look at my code and help me figure out the problem
public void AddJob()
{
var schedulerSettings = _schedulerManager.GetSchedulerSettings();
List<SchedulerSettingViewModel> schedulerModel = schedulerSettings.Select(x => new SchedulerSettingViewModel()
{
Id = x.Id,
MethodName = x.MethodName,
ScheduledHour = x.ScheduledHour,
ScheduledMinute = x.ScheduledMinute,
SchedulerIntervalId = x.SchedulerIntervalId,
SchedulerName = x.SchedulerName
}).ToList();
if (schedulerModel != null && schedulerModel.Count > 0)
{
foreach (var item in schedulerModel)
{
if (item != null)
{
RecurringJob.RemoveIfExists(item.SchedulerName);
string jobInterval = "";
if (item.SchedulerIntervalId == (int)Enums.SchedulerInterval.Hourly)
{
jobInterval = Cron.Hourly(item.ScheduledHour);
}
else
{
jobInterval = Cron.Daily(item.ScheduledHour, item.ScheduledMinute);
}
//Type thisType = this.GetType();
//MethodInfo theMethod = thisType.GetMethod(item.MethodName);
//MethodInfo method = typeof(IBackGroundJobManager).GetMethod(item.MethodName);
//RecurringJob.AddOrUpdate<IBackGroundJobManager>(item.SchedulerName, t => method.Invoke(this, null), jobInterval);
switch (item.MethodName)
{
case "Job1":
RecurringJob.AddOrUpdate<IBackGroundJobManager>(item.SchedulerName, t => t.Job1(), jobInterval);
break;
case "Job2":
RecurringJob.AddOrUpdate<IBackGroundJobManager>(item.SchedulerName, t => t.Job2(), jobInterval);
break;
case "Job3":
RecurringJob.AddOrUpdate<IBackGroundJobManager>(item.SchedulerName, t => t.Job3(), jobInterval);
break;
case "Job4":
RecurringJob.AddOrUpdate<IBackGroundJobManager>(item.SchedulerName, t => t.Job4(), jobInterval);
break;
case "Job5":
RecurringJob.AddOrUpdate<IBackGroundJobManager>(item.SchedulerName, t => t.Job5(), jobInterval);
break;
case "Job6":
RecurringJob.AddOrUpdate<IBackGroundJobManager>(item.SchedulerName, t => t.Job6(), jobInterval);
break;
}
}
}
}
}
public List<SchedulerSettingModel> GetSchedulerSettings()
{
using (_unitOfWorkManager.Begin())
{
_unitOfWorkManager.Current.SetTenantId(null);
var schedulerSettingsList = _schedulerSettingsRepository.GetAllList();
return schedulerSettingsList.Select(x => new SchedulerSettingModel()
{
Id = x.Id,
MethodName = x.MethodName,
ScheduledHour = x.ScheduledHour,
ScheduledMinute = x.ScheduledMinute,
SchedulerIntervalId = x.SchedulerIntervalId,
SchedulerName = x.SchedulerName
}).ToList();
}
}
Hi
I am trying to add a list of hangfire recurring jobs by iterating a list but I am getting an exception when running this code.
"An exception of type 'System.Transactions.TransactionManagerCommunicationException' occurred in System.Transactions.dll but was not handled in user code"
"Additional information: Network access for Distributed Transaction Manager (MSDTC) has been disabled. Please enable DTC for network access in the security configuration for MSDTC using the Component Services Administrative tool."
Here I am attacting my code
foreach(var item in schedulerModel)
{
if(item!=null)
{
RecurringJob.RemoveIfExists(item.SchedulerName);
string jobInterval = "";
if(item.SchedulerIntervalId==(int)Enums.SchedulerInterval.Hourly)
{
jobInterval = Cron.Hourly(item.ScheduledHour);
}
else
{
jobInterval = Cron.Daily(item.ScheduledHour,item.ScheduledMinute);
}
//Type thisType = this.GetType();
//MethodInfo theMethod = thisType.GetMethod(item.MethodName);
//MethodInfo method = typeof(IBackGroundJobManager).GetMethod(item.MethodName);
//RecurringJob.AddOrUpdate(item.SchedulerName,() => method.Invoke(this, null), jobInterval);
switch(item.SchedulerName)
{
case "Job1":
RecurringJob.AddOrUpdate<IBackGroundJobManager>(item.SchedulerName, t =>t.Job1(), jobInterval);
break;
case "Job2":
RecurringJob.AddOrUpdate<IBackGroundJobManager>(item.SchedulerName, t => t.Job2(), jobInterval);
break;
case "Job3":
RecurringJob.AddOrUpdate<IBackGroundJobManager>(item.SchedulerName, t => t.job3(), jobInterval);
break;
case "job4":
RecurringJob.AddOrUpdate<IBackGroundJobManager>(item.SchedulerName, t => t.job4(), jobInterval);
break;
case "job5":
RecurringJob.AddOrUpdate<IBackGroundJobManager>(item.SchedulerName, t => t.job5(), jobInterval);
break;
}
}
}
Hi,
I am trying to write code for downloading a file . I have a button called Download PDF, which will call an api to generate PDF and send the httpresponse object including the file and details, Here is my code
vm.getPDF = function () {
debugger;
$http.get('api/services/app/user/getPdf', { responseType: "arraybuffer" }).success(function (data, status, headers) {
headers = headers();
debugger;
var filename = headers['x-filename'];
var contentType = headers['content-type'];
var linkElement = document.createElement('a');
try {
var blob = new Blob([data], { type: contentType });
var url = window.URL.createObjectURL(blob);
linkElement.setAttribute('href', url);
linkElement.setAttribute("download", filename);
var clickEvent = new MouseEvent("click", {
"view": window,
"bubbles": true,
"cancelable": false
});
linkElement.dispatchEvent(clickEvent);
} catch (ex) {
console.log(ex);
}
}).error(function (data) {
console.log(data);
});
}
[HttpGet]
public HttpResponseMessage getPDF()
{
HttpResponseMessage httpResponseMessage = new HttpResponseMessage();
try
{
string fileName = "sample.pdf";
string filePath = HttpContext.Current.Server.MapPath("~/App_Data/") + fileName;
using (MemoryStream ms = new MemoryStream())
{
using (FileStream file = new FileStream(filePath, FileMode.Open, FileAccess.Read))
{
byte[] bytes = new byte[file.Length];
file.Read(bytes, 0, (int)file.Length);
ms.Write(bytes, 0, (int)file.Length);
httpResponseMessage.Content = new ByteArrayContent(bytes.ToArray());
httpResponseMessage.Content.Headers.Add("x-filename", fileName);
httpResponseMessage.Content.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream");
httpResponseMessage.Content.Headers.ContentDisposition = new ContentDispositionHeaderValue("attachment");
httpResponseMessage.Content.Headers.ContentDisposition.FileName = fileName;
httpResponseMessage.StatusCode = HttpStatusCode.OK;
}
}
return httpResponseMessage;
}
catch (Exception ex)
{
return httpResponseMessage;
}
}
But I am getting result as null, I have tried this without using the ABP (using angular js, and web api) It works fine, I am attaching both projects here , Please have a look and let me know where it went wrong.
Hi
I have an entity with multiple foreign keys (and related navigation properties). When I get the entity, all the navigation properties EXCEPT User is being returned. User is the only entity derived from ABP, all other entities are created by me. All the navigation properties are defined as 'virtual' and those are retrieved without explicit 'Include' call. The User navigation property is obtained only if I use an 'Include' call.
Is this in any way related to AbpUser?
Hi
I am developing a multi tenant application , and i need to use a cache server to store my frequent used data, How do i configure/use Redis Cache Server for caching multi tenant data
Hi
I have added a common class library project which is referred by all other projects(Web,Core,Application).
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Sample.Common.EmailHandler
{
public interface IManageEmail
{
void SendEmail();
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Sample.Common.EmailHandler
{
public class ManageEmail : IManageEmail
{
public void SendEmail()
{
//Code for Sending Email
}
}
}
using Abp.Modules;
using System;
using System.Reflection;
using System.Web;
namespace Sample.Common
{
public class SampleCommonModule : AbpModule
{
public override void Initialize()
{
IocManager.RegisterAssemblyByConvention(Assembly.GetExecutingAssembly());
}
}
}
But when I try to run project i am getting dependency injection error
{"message":"An error has occurred.","exceptionMessage":"ComponentActivator: could not proxy Abp.WebApi.Controllers.Dynamic.DynamicApiController`1[[Sample.Subscribers.ICustomerAppService, Sample.Application, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]","exceptionType":"Castle.MicroKernel.ComponentActivator.ComponentActivatorException","stackTrace":" at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateInstance(CreationContext context, ConstructorCandidate constructor, Object[] arguments)\r\n at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.Instantiate(CreationContext context)\r\n at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.InternalCreate(CreationContext context)\r\n at Castle.MicroKernel.ComponentActivator.AbstractComponentActivator.Create(CreationContext context, Burden burden)\r\n at Castle.MicroKernel.Lifestyle.AbstractLifestyleManager.CreateInstance(CreationContext context, Boolean trackedExternally)\r\n at Castle.MicroKernel.Lifestyle.AbstractLifestyleManager.Resolve(CreationContext context, IReleasePolicy releasePolicy)\r\n at Castle.MicroKernel.Handlers.DefaultHandler.ResolveCore(CreationContext context, Boolean requiresDecommission, Boolean instanceRequired, Burden& burden)\r\n at Castle.MicroKernel.Handlers.DefaultHandler.Resolve(CreationContext context, Boolean instanceRequired)\r\n at Castle.MicroKernel.Handlers.AbstractHandler.Resolve(CreationContext context)\r\n at Castle.MicroKernel.DefaultKernel.ResolveComponent(IHandler handler, Type service, IDictionary additionalArguments, IReleasePolicy policy)\r\n at Castle.MicroKernel.DefaultKernel.Castle.MicroKernel.IKernelInternal.Resolve(Type service, IDictionary arguments, IReleasePolicy policy)\r\n at Castle.MicroKernel.DefaultKernel.Resolve(Type service, IDictionary arguments)\r\n at Castle.Windsor.WindsorContainer.Resolve(Type service)\r\n at Abp.Dependency.IocManager.Resolve(Type type) in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Dependency\IocManager.cs:line 194\r\n at Abp.Dependency.IocResolverExtensions.ResolveAsDisposable[T](IIocResolver iocResolver, Type type) in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Dependency\IocResolverExtensions.cs:line 32\r\n at Abp.WebApi.Controllers.AbpApiControllerActivator.Create(HttpRequestMessage request, HttpControllerDescriptor controllerDescriptor, Type controllerType) in D:\Halil\GitHub\aspnetboilerplate\src\Abp.Web.Api\WebApi\Controllers\AbpApiControllerActivator.cs:line 24\r\n at System.Web.Http.Controllers.HttpControllerDescriptor.CreateController(HttpRequestMessage request)\r\n at System.Web.Http.Dispatcher.HttpControllerDispatcher.