Base solution for your next web application
Ends in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Issue in New Tenant creation #11202


User avatar
0
RenuSolutions created

Prerequisites

Please answer the following questions before submitting an issue. YOU MAY DELETE THE PREREQUISITES SECTION.

  • What is your product version? 11.2.0(latest)
  • What is your product type (Angular or MVC)?Angular
  • What is product framework type (.net framework or .net core)?.net core

Hi ,

i am trying to create a new tenant from the default user.It gives internal server error. Please help me through this.

Thanks AnyCollect


5 Answer(s)
  • User Avatar
    0
    sedulen created

    Hi @RenuSolutions,

    Have you done anything with your logging configuration? Is this a local environment or is this a deployed environment running on a hosting provider?

    If this is running locally or a single node/server deployed on a hosting provider, you should be able to get your web logs, under the Administration menu.

    If you click on Administration > Maintenance, that page should show you 2 tabs, 1 for Caches and another for Web Site Logs

    If you click on the Web Site Logs tab, there should be a button to "Download All"

    I would start there to see what the server-side logging states. If you can find a section of log statements that corresponds to the time that you produce that error, post it here and I'll see if I can identify anything that might help.

    Cheers! -Brian

  • User Avatar
    0
    RenuSolutions created

    Hi,

    Please find the below logs.

    ERROR 2022-07-27 11:55:43,888 [orker] Mvc.ExceptionHandling.AbpExceptionFilter - An attempt was made to access a socket in a way forbidden by its access permissions. System.Net.Sockets.SocketException (10013): An attempt was made to access a socket in a way forbidden by its access permissions. at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken) at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token) at System.Threading.Tasks.ValueTask.ValueTaskSourceAsTask.<>c.<.cctor>b__4_0(Object state) --- End of stack trace from previous location --- at System.Threading.Tasks.TaskToApm.End(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.ConnectNetwork(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 AnyCollect.Net.Emailing.AnyCollectMailKitSmtpBuilder.ConfigureClient(SmtpClient client) in C:\Users\Dell\Documents\GitHub\AnyCollect_WEB\aspnet-core\src\AnyCollect.Core\Net\Emailing\AnyCollectMailKitSmtpBuilder.cs:line 19 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 AnyCollect.Authorization.Users.UserEmailer.ReplaceBodyAndSend(String emailAddress, String subject, StringBuilder emailTemplate, StringBuilder mailMessage) in C:\Users\Dell\Documents\GitHub\AnyCollect_WEB\aspnet-core\src\AnyCollect.Core\Authorization\Users\UserEmailer.cs:line 360 at AnyCollect.Authorization.Users.UserEmailer.<>c__DisplayClass12_0.<<SendEmailActivationLinkAsync>b__0>d.MoveNext() in C:\Users\Dell\Documents\GitHub\AnyCollect_WEB\aspnet-core\src\AnyCollect.Core\Authorization\Users\UserEmailer.cs:line 124 --- End of stack trace from previous location --- at Abp.Domain.Uow.UnitOfWorkManagerExtensions.WithUnitOfWorkAsync(IUnitOfWorkManager manager, Func1 action, UnitOfWorkOptions options) at AnyCollect.Authorization.Users.UserEmailer.SendEmailActivationLinkAsync(User user, String link, String plainPassword) in C:\Users\Dell\Documents\GitHub\AnyCollect_WEB\aspnet-core\src\AnyCollect.Core\Authorization\Users\UserEmailer.cs:line 78 at AnyCollect.MultiTenancy.TenantManager.CreateWithAdminUserAsync(String tenancyName, String name, String adminPassword, String adminEmailAddress, String connectionString, Boolean isActive, Nullable1 editionId, Boolean shouldChangePasswordOnNextLogin, Boolean sendActivationEmail, Nullable1 subscriptionEndDate, Boolean isInTrialPeriod, String emailActivationLink) in C:\Users\Dell\Documents\GitHub\AnyCollect_WEB\aspnet-core\src\AnyCollect.Core\MultiTenancy\TenantManager.cs:line 176 at AnyCollect.MultiTenancy.TenantAppService.CreateTenant(CreateTenantInput input) in C:\Users\Dell\Documents\GitHub\AnyCollect_WEB\aspnet-core\src\AnyCollect.Application\MultiTenancy\TenantAppService.cs:line 59 at lambda_method3098(Closure , Object ) at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.&lt;InvokeActionMethodAsync&gt;g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask1 actionResultValueTask) 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|26_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)

  • User Avatar
    0
    sedulen created

    Hi @RenuSolutions,

    Thank you very much. The error is stated in that application log snippet. Within the Tenant provisioning endpoint, the code attempts to send the activation email to the admin user.
    It appears that email sending is failing, and there isn't anything that is catching that Exception within the endpoint.

    As a result, the UnitOfWork is failing / cancelling, and the endpoint is returning a 500 Internal Server Error response to the browers:

    If you are running the applicaiton locally, go to this line in your TenantAppService and put a breakpoint there, and then if you step through the code execution, you'll see the exception occurring. AnyCollect.Application\MultiTenancy\TenantAppService.cs:line 59

    Do you have your SMTP email configured in this instance?

    -Brian

  • User Avatar
    0
    RenuSolutions created

    Hi,

    Please mention the file to configure the SMTP settings.

    Thanks AnyCollect

  • User Avatar
    0
    sedulen created

    Hi @RenuSolutions,

    SMTP settings aren't configured in a file. These are settings configured through the User Interface

    Here is the ANZ documentation: https://docs.aspnetzero.com/en/common/v11.2.0/Features-Angular-Host-Settings#email

    Once you have those settings configured, there should be a "Test Email" capability at the bottom of that Administration > Settings page. Once you have a valid test email sent and delivered, that should be confirmation that your environment is now configured to create a new Tenant.

    Cheers, -Brian