Hi
I have read documentation related to integration with HangFire like alternative job processor. Good explanation and all work correctly, but after several days of working noticed a strange behavior different from the behavior of the classic background job manager.
Simple example to explain:
[UnitOfWork]
public void TestMethod()
{
PrepareDataForTestJob();
CurrentUnitOfWork.SaveChanges();
_backgroundJobManager.EnqueueAsync<TestJob, TestJobParams>(new TestJobParams());
throw new Exception("Some Exception");
}
Method _backgroundJobManager.EnqueueAsync enqueues job immediately and HangFire job processor starts processing without committed prepared data. In a case when method TestMethod throws exception job still exists in queue processing.
First thought, that we need to rewrite HangfireBackgroundJobManager to something like that:
public Task<string> EnqueueAsync<TJob, TArgs>(TArgs args, BackgroundJobPriority priority = BackgroundJobPriority.Normal, TimeSpan? delay = null)
where TJob : IBackgroundJob<TArgs>
{
string jobUniqueIdentifier = string.Empty;
_unitOfWorkManager.Current.Completed += (sender, args) =>
{
if (!delay.HasValue)
{
HangfireBackgroundJob.Enqueue<TJob>(job => job.Execute(args));
}
else
{
HangfireBackgroundJob.Schedule<TJob>(job => job.Execute(args), delay.Value);
}
}
return Task.FromResult(jobUniqueIdentifier); //???
}
Do you have any suggestions how to fix this correctly?
Thanks!
Hello.
I have downloaded:
For back-end - I opened solution(.\aspnet-core\Sperse.Platform.Web.sln) under VisualStudio 15.4.4 and changed in appsettings.json IdentityServer IsEnabled --> "true" than ran migrator and than started project Sperse.Platform.Web.Host under IIS Express.
For front-end - I restored packages via yarn and run npm start - after successful webpack compilation I opened a browser and went to localhost:4200 and after that I received an exception on back-end:
System.InvalidOperationException
Message:
You must either set Authority or IntrospectionEndpoint
StackTrace:
at Microsoft.AspNetCore.Builder.OAuth2IntrospectionOptions.Validate()
at IdentityModel.AspNetCore.OAuth2Introspection.PostConfigureOAuth2IntrospectionOptions.PostConfigure(String name, OAuth2IntrospectionOptions options)
at Microsoft.Extensions.Options.OptionsFactory1.Create(String name) at Microsoft.Extensions.Options.OptionsMonitor
1.<>c__DisplayClass10_0.<Get>b__0()
at System.Lazy`1.CreateValue()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
Here is HTTP Raw Request data:
GET http://localhost:22742/AbpUserConfiguration/GetAll HTTP/1.1 Host: localhost:22742 Connection: keep-alive Pragma: no-cache Origin: http://localhost:4200 Abp.TenantId: null Authorization: Bearer null Content-Type: application/json Accept: application/json, text/javascript, /; q=0.01 Cache-Control: no-cache X-Requested-With: XMLHttpRequest User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.84 Safari/537.36 .AspNetCore.Culture: c=null|uic=null Expires: Sat, 01 Jan 2000 00:00:00 GMT Referer: http://localhost:4200/ Accept-Encoding: gzip, deflate, br Accept-Language: en-US,en;q=0.9
HTTP/1.1 500 Internal Server Error Server: Kestrel X-SourceFiles: =?UTF-8?B?RDpcc291cmNlc1xBc3AuTmV0IFplcm9cQXNwLk5ldCBDb3JlICYgQW5ndWxhclw1LjAuNFxORVQgRnJhbWV3b3JrIDQuNi4xXFBsYXRmb3JtMlxQbGF0Zm9ybVxhc3BuZXQtY29yZVxzcmNcU3BlcnNlLlBsYXRmb3JtLldlYi5Ib3N0XEFicFVzZXJDb25maWd1cmF0aW9uXEdldEFsbA==?= X-Powered-By: ASP.NET Date: Mon, 18 Dec 2017 16:25:34 GMT Content-Length: 0
Hello.
I am using ASP.NET Zero (ASP net core & angular, full .net framework targeting, azure separate back and front end hosting).
I need to implement OAuth Authorization code flow for zapier - <a class="postlink" href="https://zapier.com/developer/documentation/v2/oauth-v2/">https://zapier.com/developer/documentation/v2/oauth-v2/</a>. While I was doing some investigation I found that ASP.Net Zero framework has already implemented Resource owner password flow.
As I understood I need to implement following components(to implement OAuth Authorization code flow for zapier) :
What can you recommend for easiest OAuth Authorization code with user credentials implementation? Maybe you can provide some example or tell what components are already implemented?
Hi!
We have updated our project template to latest (ASP.NET Core & Angular v4.1.3), but have some problem with running unit tests.
We have found related issue #288 and fix
<a class="postlink" href="https://github.com/aspnetzero/aspnet-zero-core/issues/288">https://github.com/aspnetzero/aspnet-ze ... issues/288</a> <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero-core/commit/3eecf4758b79f020fb6950b4772b4b1efa6262ef">https://github.com/aspnetzero/aspnet-ze ... 1efa6262ef</a>
but it not fully resolve our issue. Now We receive another exception:
Message: System.NotSupportedException : SQLite does not support schemas. For more information, see <a class="postlink" href="http://go.microsoft.com/fwlink/?LinkId=723262">http://go.microsoft.com/fwlink/?LinkId=723262</a>
Yes, We have db tables/entities with not default schema dbo.
Any ideas how to fix this?
Thanks
Hi,
I have simple data entity and appropriated dto entity
[Table("Packages", Schema = "Test")]
public class Package : FullAuditedEntity, IMustHaveTenant
{
public int TenantId { get; set; }
[Required]
[MaxLength(50)]
public string Name { get; set; }
}
[AutoMapFrom(typeof(Package))]
public class PackageDto : FullAuditedEntityDto
{
public int TenantId { get; set; }
public string Name { get; set; }
}
I have public (without authorization attribute) service:
public class PackageAppService : AppServiceBase, IPackageAppService
{
private readonly IRepository<Package> _packageRepository;
public PackageAppService(IRepository<Package> packageRepository)
{
_packageRepository = packageRepository;
}
public ListResultDto<PackageDto> GetAll()
{
var packages = _packageRepository.GetAll();
return new ListResultDto<PackageDto>(ObjectMapper.Map<List<PackageDto>>(packages));
}
}
When I call service method GetAll from host ( or public) context I receive list of all packages not filtered by tenantid null. When I use interface IMayHaveTenant instead of IMustHaveTenant all work correct. It's a bug?
Thanks.
Hi!
We have tried to integrate OData for project with 'ASP.NET Core & Angular 2+' template like described in the documentation: <a class="postlink" href="https://aspnetboilerplate.com/Pages/Documents/OData-Integration">https://aspnetboilerplate.com/Pages/Doc ... ntegration</a>
When We added reference to Abp.Web.Api.OData package and specified depended module AbpWebApiODataModule to WebCoreModule (or WebHostModule) we have received exception on application startup:
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
app.UseAbp(); <=EXCEPTION!
...
}
Message: System.NullReferenceException: 'Object reference not set to an instance of an object.' Source: mscorlib StackTrace: at System.Security.Permissions.FileIOPermission.CheckIllegalCharacters(String[] str, Boolean onlyCheckExtras)
It is posible to integrate OData with ASP.NET Core? What we are doing wrong?
Thanks
Hi, Could you suggest how to implement field level permissions using ASP.NET Boilerplate framework?
For example: I have entity Customer with fields Name, Address, Email. Some users should have permissions to read/modify Email field values.
I know how to check current user permission and how to show/hide appropriated fields on view. But what about service endpoint methods?
It would be great to have one place to specify these permissions, may be by attributes on entity's fields:
[ReadPermission("Customer.Email.Read")]
[ModifyPermission("Customer.Email.Write")]
public string Email {get; set; }
Then I need to have methods to control read/update permissions on field level:
string[] fields = Customer.Metadata.GetReadFields(User.Permissions);
_customerRepository.GetAllIncluding("Name", "Address");
var customer = customerInput.MapTo<Customer>("Name", "Address");
Thanks in advance!