Base solution for your next web application

Activities of "smry"

I can access tenant.mysite.com but entire login section is now missing and Logs nor client side networking show seemingly relavent error or any errors that would shed light on why login section gone

Azure VM with IP:

Domain Registrar with sole DNS record pointing to that IP:

IIS Inside of VM pointing port 80 with binding to Azure VM IP

Trying to access site from browser:


Edit #1: Two things needed to be changed to get some form of site response - Our Domain Registrar told me to use the following edits which worked:

  1. Use of A record instead of CNAME for Host: *
  2. add an A record | Host: @ | Value: MyIP

those two things pointed my domain to the sever

On the server, IIS needed the following to get anything showing on the address:

Here is the IP Addresses page on Azure VM Without 10.0.0.4:80 as an Azure Binding, the page only shows HTTP unreachable pages - not sure if this is an quirk of Azure OR if this is a deeper issue

Something now loads on the page but on the login page the Login section is now gone:


Edit #2:

I think I found why it disappears but not sure how to fix it

appsettings.Prod:

"App": {
"ServerRootAddress": "http://{TENANCY_NAME}.mysite.com:19945",
"ClientRootAddress": "http://{TENANCY_NAME}.mysite.com",
"CorsOrigins": "http://*.mysite.com"
}

appconfig.production.json

  "remoteServiceBaseUrl": "http://{TENANCY_NAME}.mysite.com:19945",
  "appBaseUrl": "http://{TENANCY_NAME}.mysite.com",
  

The addition of {TENANCY_NAME} in the appconfig.production.json appBaseUrl causes the Login portion to disappear as seen above

In addition to that, if I remove that, then all tenants go to host application

I didnt realize the issues might related so I opened https://support.aspnetzero.com/QA/Questions/8280 to try to fix that section. I am not sure how/if their related

I am hosting my site through an Azure VM I have a domain that I would like to host my multi-tenant application through

If I go to myCompany.cloudapp.net it shows a working host site

On my domain, I updated the CNAME to myCompany.cloudapp.net so now mySite.com shows the application

*at this point, everything seems to be working exactly as expected

I tried following https://docs.aspnetzero.com/en/aspnet-core-angular/latest/Overview-Angular#multi-tenancy

I think I'm getting lost here:

To do that;

1. You should configure DNS to redirect all subdomains to a static IP address. To declare 'all subdomains', you can use a wildcard e.g. *.mydomain.com.
2. You should configure IIS to bind this static IP to your application.

If I setup a *. redirect on the domain then I get:

Request URL: http://tenant.mySite.com/
Request Method: GET
Status Code: 302 Found

which then immediately opens

Request URL: http://www.mySite.com/
Request Method: GET
Status Code: 200 OK

The host site opens up and i've lost my tenant name from the URL

Can you please elaborate on "configure IIS to bind this static IP to your application" or anything else I might be missing

I can go into IIS on the VM and add a second AngularUI folder setup and an IIS-site for http://tenant.mySite.com which makes it such the domain URL wildcard redirect isnt levereaged but it still drops the tenant name in the URL

 <environmentVariable name="ASPNETCORE_ENVIRONMENT" value="**Development**" />

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

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

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

@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.

@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

        public async Task&lt;int&gt; 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."

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?

Showing 71 to 80 of 83 entries