Base solution for your next web application

Activities of "smry"

launchsettings for just the Host file or all files? I am still running into what I believe is this issue

redownloaded my project, changed just that file in that way, built/rebuilt/npm/yarn - working solution At this point I believe that was my issue and starting from scratch seemed to correct the issue

I noticed the collection of methods that worked to retrieve the contents of the localization files and a method to update the contents of the localization files but was unable to see how the Update code was able to be used.

I have two questions:

  1. Is there documentation that is an example resource of how to update the localization files - either on the running application or in the source code
  2. Is there any additional software that would work as a tool for entry maintenance for all the available localization files - or is that level of IO done either by hand or a tool we would have to build inhouse?

Where do I update the connection string for Power Tools to a different database(s)? It seems as if the only way to use Power Tools in a multitenant setup is to create Entity on Host Db then copy schema to each Tenant DB.

Is there anything in the tool that allows a single new Entity deployment to go to multiple databases?

        public async Task<int> CreateWithAdminUserAsync(...)
                {
                    int newTenantId;
                    long newAdminId;

        await CheckEditionAsync(editionId, isInTrialPeriod);

        using (var uow = _unitOfWorkManager.Begin(TransactionScopeOption.RequiresNew))
        {
            //Create tenant
            var tenant = new Tenant(tenancyName, name)
            {
                IsActive = isActive,
                EditionId = editionId,
                SubscriptionEndDateUtc = subscriptionEndDate?.ToUniversalTime(),
                IsInTrialPeriod = isInTrialPeriod,
                ConnectionString = connectionString.IsNullOrWhiteSpace() ? null :                SimpleStringCipher.Instance.Encrypt(connectionString)
            };

            try
            {
            await CreateAsync(tenant);
            await _unitOfWorkManager.Current.SaveChangesAsync(); //To get new tenant's id.

            //Create tenant database
            _abpZeroDbMigrator.CreateOrMigrateForTenant(tenant);
            }
            catch (Exception ex)
            {
                //Fails here: {"There is already an object named 'MyPowerToolCreatedEntity' in the database."}
            }
            

Im having this same issue but different failure. It seems to fail due to an entity that was created with the Power Tool. My code fails a few lines above where nitinrpatel's code fails. It creates the database in the right location but _abpZeroDbMigrator.CreateOrMigrateForTenant(tenant); fails saying "There is already an object named 'MyPowerToolCreatedEntity' in the database."

@maliming - within the past few days we:

  1. created a tenant with its own DB
  2. added a tenant with shared host db
  3. Added an entity with the Power Tool
  4. Added new Tenant with its own DB
    1. Errors here:
2019-12-19 10:01:44 | An error occured during migration of tenant database:
2019-12-19 10:01:44 | Microsoft.Data.SqlClient.SqlException (0x80131904): There is already an object named 'MyEntity' in the database.
   at Microsoft.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
   at Microsoft.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
   at Microsoft.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
   at Microsoft.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
   at Microsoft.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean isAsync, Int32 timeout, Boolean asyncWrite)
   at Microsoft.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, Boolean sendToPipe, Int32 timeout, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry, String methodName)
   at Microsoft.Data.SqlClient.SqlCommand.ExecuteNonQuery()
   at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteNonQuery(RelationalCommandParameterObject parameterObject)
   at Microsoft.EntityFrameworkCore.Migrations.MigrationCommand.ExecuteNonQuery(IRelationalConnection connection, IReadOnlyDictionary`2 parameterValues)
   at Microsoft.EntityFrameworkCore.Migrations.Internal.MigrationCommandExecutor.ExecuteNonQuery(IEnumerable`1 migrationCommands, IRelationalConnection connection)
   at Microsoft.EntityFrameworkCore.Migrations.Internal.Migrator.Migrate(String targetMigration)
   at Microsoft.EntityFrameworkCore.RelationalDatabaseFacadeExtensions.Migrate(DatabaseFacade databaseFacade)
   at Abp.Zero.EntityFrameworkCore.AbpZeroDbMigrator`1.CreateOrMigrate(AbpTenantBase tenant, Action`1 seedAction)
   at Abp.Zero.EntityFrameworkCore.AbpZeroDbMigrator`1.CreateOrMigrateForTenant(AbpTenantBase tenant, Action`1 seedAction)
   at Abp.Zero.EntityFrameworkCore.AbpZeroDbMigrator`1.CreateOrMigrateForTenant(AbpTenantBase tenant)
   at medrx.Migrator.MultiTenantMigrateExecuter.Run(Boolean skipConnVerification) in C:\dev\webProj\medRx-API\src\medrx.Migrator\MultiTenantMigrateExecuter.cs:line 90
ClientConnectionId:[...]
Error Number:2714,State:6,Class:16
2019-12-19 10:01:44 | Skipped this tenant and will continue for others...
2019-12-19 10:01:44 | Tenant database migration completed. (1 / 2)
2019-12-19 10:01:44 | --------------------------------------------------------

There were a handful of other minor changes that were also done in-between steps 3 and 4 so I am unfortunately not able to identify a better recreation of steps for the error – I wanted to make sure that this was mentioned since I also saw an issue in the same location that nitinrpatel did – although may ultimately be unrelated

I’ll make sure to update should I figure out how to clear the error – as of now it does create all databases so I can work around it in some capacity

@yekalkan - nope, I deleted the entire DB and on re-build it still fails with that error The only solution I had was to remove migrations back to before the first Entity creation

Starting from a fresh template and redoing the process, no errors were found.

I have the downloaded application largely unmodified but known working on local instance Followed https://docs.aspnetzero.com/en/aspnet-core-angular/latest/Deployment-Angular-Publish-Azure for a split application and having errors

Error in console:

Default levels
GET https://azure-publish-demo-server.azurewebsites.net/AbpUserConfiguration/GetAll?d=1576866925084 500 (Internal Server Error)
abp.js:342 WARN: 
abp.js:342 Could not find localization source: AbpWeb

Error in App/Log/:

WARN  2019-12-20 16:48:12,915 [8    ] Abp.BackgroundJobs.BackgroundJobManager  - Microsoft.Data.SqlClient.SqlException (0x80131904): 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)
---> System.ComponentModel.Win32Exception (2): The system cannot find the file specified.
…

Top portion of appconfig.production.json:

{
  "remoteServiceBaseUrl": "https://azure-publish-demo-server.azurewebsites.net",
  "appBaseUrl": "https://azure-publish-demo-client.azurewebsites.net",
  "localeMappings": {
    "angular": [
      {…

appsettings.Production.json:

{
  "ConnectionStrings": {
    "Default": "Server=tcp:azure-publish-demo.database.windows.net;Database=AzurePublishDemoDb;User ID=admin;Password=mypassword;"
  },
  "App": {
    "ServerRootAddress": "https://azure-publish-demo-server.azurewebsites.net",
    "ClientRootAddress": "https://azure-publish-demo-client.azurewebsites.net",
    "CorsOrigins": "https://azure-publish-demo-client.azurewebsites.net"
  }
}

Originally having issues where the console was saying CORs errors so I went on both client and server Azure resources and set Enable Access-Control-Allow-Credentials to enabled

I had this issue and just assumed the code was there for looks but didnt actually work (Meaning the only thing it did was show "test email sent" but no backend code did anything)

After maliming's comment I realized it wasnt just me.

I started checking what the log said as he mentioned and log mentioned:

INFO  [35   ] pNetCore.Cors.Infrastructure.CorsService - CORS policy execution successful.       
INFO  [35   ] uthentication.JwtBearer.JwtBearerHandler - Successfully validated the token.
INFO  [35   ] ft.AspNetCore.Routing.EndpointMiddleware - Executing endpoint 'companyName.Configuration.Host.HostSettingsAppService.SendTestEmail (companyName.Application)'
INFO  [35   ] c.Infrastructure.ControllerActionInvoker - Route matched with {area = "app", action = "SendTestEmail", controller = "HostSettings"}. Executing controller action with signature System.Threading.Tasks.Task SendTestEmail(companyName.Configuration.Host.Dto.SendTestEmailInput) on controller companyName.Configuration.Host.HostSettingsAppService (companyName.Application).
WARN  [35   ] Abp.Net.Mail.NullEmailSender             - USING NullEmailSender!
DEBUG [35   ] Abp.Net.Mail.NullEmailSender             - SendEmailAsync:
DEBUG [35   ] Abp.Net.Mail.NullEmailSender             - [email protected]
DEBUG [35   ] Abp.Net.Mail.NullEmailSender             - 
DEBUG [35   ] Abp.Net.Mail.NullEmailSender             - companyName test email
DEBUG [35   ] Abp.Net.Mail.NullEmailSender             - This is a test email.
INFO  [32   ] .Mvc.Infrastructure.ObjectResultExecutor - Executing ObjectResult, writing value of type 'Abp.Web.Models.AjaxResponse'.
INFO  [32   ] c.Infrastructure.ControllerActionInvoker - Executed action companyName.Configuration.Host.HostSettingsAppService.SendTestEmail (companyName.Application) in 27.1706ms
INFO  [32   ] ft.AspNetCore.Routing.EndpointMiddleware - Executed endpoint 'companyName.Configuration.Host.HostSettingsAppService.SendTestEmail (companyName.Application)'
INFO  [32   ] Microsoft.AspNetCore.Hosting.Diagnostics - Request finished in 51.2509ms 200 application/json; charset=utf-8

"USING NullEmailSender!" caught my eye and when I went searching the source, I came across this that solved my issue:

if (DebugHelper.IsDebug)
    {
        //Disabling email sending in debug mode
        Configuration.ReplaceService<IEmailSender, NullEmailSender>(DependencyLifeStyle.Transient);
    }

Edit: One additional intersting thing I noticed - You have to Save All in order to get the credentials to update, so after you input your SMTP credentials, Save All, THEN send test email - otherwise it tries to use the 127.0.0.0 credentials it originally has

 &lt;environmentVariable name=&quot;ASPNETCORE_ENVIRONMENT&quot; value=&quot;**Development**&quot; /&gt;

we moved to a different hosting platform and it resolved the issue but I think you were right in pointing out that the API was built incorrectly I think there may have also been additional routing issues within Azure portal itself

Showing 1 to 10 of 83 entries