ANZ 8.1.0 angular/.NET core
localhost browser width > 640 px:
localhost browser width < 640 px:
The first three images display data as expected. The fourth image fails to display data.
All screenshots use the same login credentials and same database. There are no errors in the server log file.
How can I determine the cause of data not being displayed? What tools are available to troubleshoot angular client code on Azure?
ANZ 8.1.0 angular/.net core
Occasionally my ANZ app works when Published.
I make a small change, and then I get the following message from the client site in the Chrome debug console:
Access to XMLHttpRequest at 'https://myapp-server.azurewebsites.net//AbpUserConfiguration/GetAll?d=1616355221806' from origin 'https://myapp-client.azurewebsites.net' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
The server app is able to display swagger login page. The error persists even after rolling back the change. What might be causing this? How can I diagnose the cause?
ANZ 8.1.0 angular/.NET core
An unhandled exception occurred while processing the request.
Win32Exception: The system cannot find the file specified.
Unknown location
SqlException: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
Microsoft.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, uint waitForMultipleObjectsTimeout, bool allowCreate, bool onlyOneCheckConnection, DbConnectionOptions userOptions, out DbConnectionInternal connection)
...appears in the browser. How can I diagnose this? How can I know the connection string that is invalid?
ANZ version 8.1.0 angular/.net core
When attempting to register a new user, the following error occurs with Release builds. Debug builds to not report the error. Error from "Logs.txt":
ERROR 2021-03-21 10:11:42,888 [9 ] Mvc.ExceptionHandling.AbpExceptionFilter - An attempt was made to access a socket in a way forbidden by its access permissions. 127.0.0.1:25
System.Net.Internals.SocketExceptionFactory+ExtendedSocketException (10013): An attempt was made to access a socket in a way forbidden by its access permissions. 127.0.0.1:25
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw(Exception source)
at System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult)
at MailKit.Net.SocketUtils.ConnectAsync(String host, Int32 port, IPEndPoint localEndPoint, Boolean doAsync, CancellationToken cancellationToken)
at MailKit.Net.SocketUtils.ConnectAsync(String host, Int32 port, IPEndPoint localEndPoint, Int32 timeout, Boolean doAsync, CancellationToken cancellationToken)
at MailKit.MailService.ConnectSocket(String host, Int32 port, Boolean doAsync, CancellationToken cancellationToken)
at MailKit.Net.Smtp.SmtpClient.ConnectAsync(String host, Int32 port, SecureSocketOptions options, Boolean doAsync, CancellationToken cancellationToken)
at MailKit.Net.Smtp.SmtpClient.Connect(String host, Int32 port, SecureSocketOptions options, CancellationToken cancellationToken)
at Abp.MailKit.DefaultMailKitSmtpBuilder.ConfigureClient(SmtpClient client)
at ngTTM.Net.Emailing.ngTTMMailKitSmtpBuilder.ConfigureClient(SmtpClient client) in C:\Users\Tim\Documents\__ngTTMv810\ngTTM\aspnet-core\src\ngTTM.Core\Net\Emailing\ngTTMMailKitSmtpBuilder.cs:line 20
at Abp.MailKit.DefaultMailKitSmtpBuilder.Build()
at Abp.MailKit.MailKitEmailSender.BuildSmtpClient()
at Abp.MailKit.MailKitEmailSender.SendEmailAsync(MailMessage mail)
at Abp.Net.Mail.EmailSenderBase.SendAsync(MailMessage mail, Boolean normalize)
at ngTTM.Authorization.Users.UserEmailer.ReplaceBodyAndSend(String emailAddress, String subject, StringBuilder emailTemplate, StringBuilder mailMessage) in C:\Users\Tim\Documents\__ngTTMv810\ngTTM\aspnet-core\src\ngTTM.Core\Authorization\Users\UserEmailer.cs:line 360
at ngTTM.Authorization.Users.UserEmailer.SendEmailActivationLinkAsync(User user, String link, String plainPassword) in C:\Users\Tim\Documents\__ngTTMv810\ngTTM\aspnet-core\src\ngTTM.Core\Authorization\Users\UserEmailer.cs:line 124
at Abp.Threading.InternalAsyncHelper.AwaitTaskWithPostActionAndFinally(Task actualReturnValue, Func`1 postAction, Action`1 finalAction)
at ngTTM.Authorization.Users.UserRegistrationManager.RegisterAsync(String name, String surname, String emailAddress, String userName, String plainPassword, String webPageUrl, Boolean tosAcceptance, Boolean isInvitee, Boolean isVerified, Boolean isEmailConfirmed, String emailActivationLink) in C:\Users\Tim\Documents\__ngTTMv810\ngTTM\aspnet-core\src\ngTTM.Core\Authorization\Users\UserRegistrationManager.cs:line 110
at ngTTM.Authorization.Accounts.AccountAppService.Register(RegisterInput input) in C:\Users\Tim\Documents\__ngTTMv810\ngTTM\aspnet-core\src\ngTTM.Application\Authorization\Accounts\AccountAppService.cs:line 302
at lambda_method(Closure , Object )
at Microsoft.Extensions.Internal.ObjectMethodExecutorAwaitable.Awaiter.GetResult()
at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Logged|12_1(ControllerActionInvoker invoker)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeInnerFilterAsync>g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
question withdrawn - OK to delete
ANZ version 8.1.0 Angular/.net core
Following instructions here: https://docs.aspnetzero.com/en/aspnet-core-angular/latest/Deployment-Angular-Publish-Azure Apply Migrations section.
The following error occurs when attempting 'update-database'. Please advise on how to proceed. Thank you.
Package Manager Console:
Each package is licensed to you by its owner. NuGet is not responsible for, nor does it grant any licenses to, third-party packages. Some packages may include dependencies which are governed by additional licenses. Follow the package source (feed) URL to determine any dependencies.
Package Manager Console Host Version 5.9.0.7134
Type 'get-help NuGet' to see all available NuGet commands.
PM> update-database
Build started...
Build succeeded.
RequestId:28362d0d-501a-0068-27a9-1b74df000000
Time:2021-03-18T03:51:27.6418034Z
An error occurred while accessing the Microsoft.Extensions.Hosting services. Continuing without the application service provider. Error: The resource doesn't support specified Http Verb.
RequestId:28362d0d-501a-0068-27a9-1b74df000000
Time:2021-03-18T03:51:27.6418034Z
Status: 405 (The resource doesn't support specified Http Verb.)
ErrorCode: UnsupportedHttpVerb
Headers:
Server: Windows-Azure-File/1.0,Microsoft-HTTPAPI/2.0
x-ms-request-id: 28362d0d-501a-0068-27a9-1b74df000000
x-ms-client-request-id: 64972fb1-e660-4a27-8059-175e9ddc04ee
x-ms-version: 2020-04-08
x-ms-error-code: UnsupportedHttpVerb
Date: Thu, 18 Mar 2021 03:51:27 GMT
Allow: REDACTED
Content-Length: 237
Content-Type: application/xml
System.ArgumentException: Keyword not supported: 'perpendere-dev-dbserver.database.windows.net; database'.
at Microsoft.Data.Common.DbConnectionOptions.ParseInternal(Dictionary`2 parsetable, String connectionString, Boolean buildChain, Dictionary`2 synonyms, Boolean firstKey)
at Microsoft.Data.Common.DbConnectionOptions..ctor(String connectionString, Dictionary`2 synonyms)
at Microsoft.Data.SqlClient.SqlConnectionString..ctor(String connectionString)
at Microsoft.Data.SqlClient.SqlConnectionFactory.CreateConnectionOptions(String connectionString, DbConnectionOptions previous)
at Microsoft.Data.ProviderBase.DbConnectionFactory.GetConnectionPoolGroup(DbConnectionPoolKey key, DbConnectionPoolGroupOptions poolOptions, DbConnectionOptions& userConnectionOptions)
at Microsoft.Data.SqlClient.SqlConnection.ConnectionString_Set(DbConnectionPoolKey key)
at Microsoft.Data.SqlClient.SqlConnection.set_ConnectionString(String value)
at Microsoft.Data.SqlClient.SqlConnection..ctor(String connectionString)
at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerConnection.CreateDbConnection()
at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.get_DbConnection()
at Microsoft.EntityFrameworkCore.Diagnostics.RelationalLoggerExtensions.MigrateUsingConnection(IDiagnosticsLogger`1 diagnostics, IMigrator migrator, IRelationalConnection connection)
at Microsoft.EntityFrameworkCore.Migrations.Internal.Migrator.Migrate(String targetMigration)
at Microsoft.EntityFrameworkCore.Design.Internal.MigrationsOperations.UpdateDatabase(String targetMigration, String contextType)
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.UpdateDatabaseImpl(String targetMigration, String contextType)
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.UpdateDatabase.<>c__DisplayClass0_0.<.ctor>b__0()
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.Execute(Action action)
Keyword not supported: 'perpendere-dev-dbserver.database.windows.net; database'.
PM>
for security reasons 'appsettings.json' sent by email.
ANZ v10.0.0
Not sure which organization can fix this, so am reporting the issue here.
On the server the following enum is not accurately exported to typescript.
namespace EnumsLibrary
{
public enum SeatType
{
NoSeat = 0, // bitfields
SeatTypeFirst_Seat = 0,
SeatTypeFirst_Student = 1,
LeftHanded = 1,
RightHanded = 2,
Ambidextrous = 3,
NoPreference = 3,
Handicap = 4,
LastSeatType = 4,
DefaultProfile = 5,
Blocked = 6
}
}
After running 'refresh.bat' in \angular\nswag results in:
export enum SeatType {
NoSeat = 0,
SeatTypeFirst_Seat = 1,
SeatTypeFirst_Student = 2,
LeftHanded = 3,
RightHanded = 4,
Ambidextrous = 5,
NoPreference = 6,
}
... in service-proxy.ts
This may be due to the disconnect of identifiers and values in 'https://localhost:44301/swagger/v1/swagger.json'
"SeatType": {
"enum": [
0,
1,
2,
3,
4,
5,
6
],
"type": "integer",
"format": "int32",
"x-enumNames": [
"NoSeat",
"SeatTypeFirst_Seat",
"SeatTypeFirst_Student",
"LeftHanded",
"RightHanded",
"Ambidextrous",
"NoPreference",
"Handicap",
"LastSeatType",
"DefaultProfile",
"Blocked"
]
},
It seems the first 7 values are assigned to the first 7 identifiers.
This was not an issues for ANZ V8.0.0. SeatType was accurately reflected in service-proxy.cs
export enum SeatType {
NoSeat = 0,
SeatTypeFirst_Seat = 0,
SeatTypeFirst_Student = 1,
LeftHanded = 1,
RightHanded = 2,
Ambidextrous = 3,
NoPreference = 3,
Handicap = 4,
LastSeatType = 4,
DefaultProfile = 5,
Blocked = 6,
}
... and in swagger.json
"SeatType": {
"enum": [
0,
0,
1,
1,
2,
3,
3,
4,
4,
5,
6
],
"type": "integer",
"format": "int32",
"x-enumNames": [
"NoSeat",
"SeatTypeFirst_Seat",
"SeatTypeFirst_Student",
"LeftHanded",
"RightHanded",
"Ambidextrous",
"NoPreference",
"Handicap",
"LastSeatType",
"DefaultProfile",
"Blocked"
]
},
Migrating from v8.0.0 to v10.0.0 Angular / .net core
WARNING in Conflict: Multiple assets emit different content to the same filename fa-brands-400.eot
I have purchased a license to use Fontawesome and installed it in 'node_modules@fortawesome\fontasesome-pro', which already includes these files.
How can I remove the 15 files from the bundles (2) and .js in src\assets\metronic\vendors\global,@fortawesome so that the app will reference the files in \node_modules@fortawesome?
Product Version 8.0.0 Product Type: Angular Framework: .NET Core 3.0 ABP Framework: 5.0
I'm currently using the BackgroundJob class successfully. Some jobs execute in few seconds. Other jobs execute in minutes or hours. Each job is independent, with no dependency on previously executed jobs. Jobs are initiated by user actions. Long running jobs cause fast running jobs to wait until the long running job has finished because BackgroundJob executes queued jobs sequentially. This causes one user's job to wait until all other jobs have run to completion. How can I implement "fire and forget" jobs (or Tasks) that execute in parallel? I want a user's job to begin execution immediately.
Below are code snippets of the current implementation:
[AbpAuthorize(AppPermissions.Pages_Exams)]
public class ExamsAppService : ngTTMAppServiceBase, IExamsAppService
{
.
.
.
[AbpAuthorize(AppPermissions.Pages_Exams_Create)]
private async Task<ServiceStatusDto> CreateExamJob(string examGuid)
{
ServiceStatusDto status = new ServiceStatusDto(L("Exams"), L("Success"));
long UserId = (long)AbpSession.UserId;
string workingDirectory = _webHostEnvironment.ContentRootPath;
try
{
CreatJobArgs args =
new CreatJobArgs
{
tenantId = AbpSession.TenantId,
userId = UserId,
jobGuid = examGuid,
folder = StorageLibrary.Storage.FILES_FOLDER,
operation = JobOps.JOB_OP_CREATE,
workingDirectory = workingDirectory
};
using (_abpSession.Use(AbpSession.TenantId, UserId))
{
status.BackgroundJobId = await
_backgroundJobManager.EnqueueAsync<CreateExamJob, CreatJobArgs>(args);
}
status.Guid = examGuid;
return status;
}
catch (Exception ex)
{
ExceptionUtility.LogException(UserId, ex);
status.Success = false;
status.FailureReason = ex.Message;
return status;
}
}
}
=============================================
public class CreateExamJob : BackgroundJob<CreatJobArgs>, ITransientDependency, IApplicationService
{
private readonly ITempFileCacheManager _tempFileCacheManager;
private readonly IWebHostEnvironment _hostingEnvironment;
private readonly ISettingManager _settingManager;
private readonly ILocalizationManager _localizationManager;
private readonly IAbpSession _abpSession;
private readonly IBinaryObjectManager _binaryObjectManager;
private DateTime jobStartTime;
public CreateExamJob(
ITempFileCacheManager tempFileCacheManager,
ISettingManager settingManager,
IWebHostEnvironment hostingEnvironment,
ILocalizationManager localizationManager,
IBinaryObjectManager binaryObjectManager,
IAbpSession abpSession
)
{
_settingManager = settingManager;
_hostingEnvironment = hostingEnvironment;
_tempFileCacheManager = tempFileCacheManager;
_localizationManager = localizationManager;
_binaryObjectManager = binaryObjectManager;
_abpSession = abpSession;
}
[UnitOfWork]
public override void Execute(CreatJobArgs args)
{
jobStartTime = DateTime.Now;
using (CurrentUnitOfWork.SetTenantId(args.tenantId))
{
using (_abpSession.Use(args.tenantId, args.userId))
{
UserIdentifier _userId = new UserIdentifier(args.tenantId, (long)args.userId);
string userLanguage = _settingManager.GetSettingValueForUser(LocalizationSettingNames.DefaultLanguage, _userId);
CultureInfo culture = CultureHelper.GetCultureInfoByChecking(userLanguage);
Thread.CurrentThread.CurrentUICulture = culture;
LocalizationSourceName = ngTTMConsts.LocalizationSourceName;
Execute_MyCode(args); // How to "fire and forget" this? Or an instance of the CreateExamJob class?
}
}
}
}
==========================================
[Serializable]
public class CreatJobArgs
{
public string fileToken { get; set; }
public string folder { get; set; }
public string jobGuid { get; set; }
public string operation { get; set; }
public int? tenantId { get; set; }
public long? userId { get; set; }
public string workingDirectory { get; set; }
}
I created a Background Job per the following instructions: Background Jobs
However, the _binaryObjectRepository
does not appear to be connected to the db.
var _all = _binaryObjectRepository.GetAllList();
does not cause Exceptions, but also does not return any values.
How can I get this to work?
Also, maybe for another issue, _localizationManager
only returns English language string - ignores all other language settings - returns English strings.
These issues only appear in a Background Job. They work as expected in AppServices.
Another clue: _settingManager
works correctly as expected.
using Abp.Application.Services;
using Abp.BackgroundJobs;
using Abp.Configuration;
using Abp.Domain.Uow;
using Abp.Localization;
using Abp.Runtime.Session;
using Abp.Dependency;
using Abp.EntityFrameworkCore;
using ExceptionsLibrary;
using JobsLibrary;
using Microsoft.AspNetCore.Hosting;
using ngTTM.Storage;
using System;
using System.IO;
using Abp.Domain.Repositories;
#if EXAM_DB_CONTEXT_LIB
using DbContext = ExamDbContextLibrary.ExamDbContext;
#else
using ngTTM.TtmDataModel;
using DbContext = ngTTM.EntityFrameworkCore.ngTTMDbContext;
#endif
namespace JobManager
{
//-----------------------------------------------------------------------------------------
[Serializable]
public class CreateExamJobArgs
{
public long userId { get; set; }
public string guid { get; set; }
public string operation { get; set; }
public string folder { get; set; }
public string workingDirectory { get; set; }
public string fileToken { get; set; }
}
//-----------------------------------------------------------------------------------------
public class CreateExamJob : BackgroundJob<CreateExamJobArgs>, ITransientDependency, IApplicationService
{
//=========================================================================================
#region Private Fields
//-----------------------------------------------------------------------------------------
private readonly ITempFileCacheManager _tempFileCacheManager;
private readonly IDbContextProvider<DbContext> _dbContextProvider;
private readonly IWebHostEnvironment _hostingEnvironment;
private readonly ISettingManager _settingManager;
private readonly ILocalizationManager _localizationManager;
private readonly IAbpSession _abpSession;
private readonly IRepository<BinaryObject, Guid> _binaryObjectRepository;
private readonly IBinaryObjectManager _binaryObjectManager;
//-----------------------------------------------------------------------------------------
#endregion Private Fields
//=========================================================================================
//-----------------------------------------------------------------------------------------
public CreateExamJob(
ITempFileCacheManager tempFileCacheManager,
IDbContextProvider<DbContext> dbContextProvider,
ISettingManager settingManager,
IWebHostEnvironment hostingEnvironment,
ILocalizationManager localizationManager,
IRepository<BinaryObject, Guid> binaryObjectRepository,
IBinaryObjectManager binaryObjectManager,
IAbpSession abpSession
)
{
//Debug.WriteLine("CreateExamJob.CreateExamJob()");
_dbContextProvider = dbContextProvider;
_settingManager = settingManager;
_hostingEnvironment = hostingEnvironment;
_tempFileCacheManager = tempFileCacheManager;
_localizationManager = localizationManager;
_binaryObjectRepository = binaryObjectRepository;
_binaryObjectManager = binaryObjectManager;
_abpSession = abpSession;
}
//----------------------------------------------------------------------------------------
[UnitOfWork]
public override void Execute(CreateExamJobArgs args)
{
try
{
var _all = _binaryObjectRepository.GetAllList();
var alllist = _binaryObjectRepository.GetAllList(bo => bo.TenantId == 1);
}
catch (Exception ex)
{
ExceptionUtility.LogException(args.userId, ex);
}
}
//-----------------------------------------------------------------------------------------
}
}