I have an app service which is hosted on Azure. I have code which creates an app managed certificate and then binds the certificate to the app. It could take several minutes for Azure to create the certificate, so I have to wait for the certificate to be created before I can bind the certificate to the app custom domain.
public static async Task<bool> CreateCustomDomainAndCertificate(string sHostName, string sUserEmail)
{
bool bRet = false;
HttpResponseMessage responseMessage = await CreateCustomDomain(sHostName);
if (responseMessage.IsSuccessStatusCode)
{
Log.Logger.Information($"{sUserEmail} created hostname {sHostName}");
bool bCertificateExists = await DoesCertificateExistAsync(sHostName);
if(!bCertificateExists)
responseMessage = await CreateAppManagedCertificate(sHostName);
/*
it can take a good 5 minutes to create the certificate
but you get the 202 status code right away.
You cannot bind the certificate to the custom domain
name until after the certificate actually exists.
*/
if ((long)responseMessage.StatusCode == 202 || (bCertificateExists && (long)responseMessage.StatusCode == 200))// 202 = Accepted, 200 = Ok
{
Log.Logger.Information($"{sUserEmail} created app managed certificate for hostname {sHostName}");
DateTime dtStart = DateTime.Now;
while ((long)responseMessage.StatusCode != 200 && DateTime.Now < dtStart.AddMinutes(10))
{//Wait until the certificate has been created, up to 10 minutes
Log.Logger.Information($"{sUserEmail} starting 10 second wait");
Thread.Sleep(10000);//10 seconds
Log.Logger.Information($"{sUserEmail} finish 10 second wait");
responseMessage = await BindCertificateToCustomDomain(sHostName);
if ((long)responseMessage.StatusCode == 200)
{
bRet = true;
Log.Logger.Information($"{sUserEmail} binded app managed certificate to hostname {sHostName}");
return true;
}
else
{
Log.Logger.Information($"{sUserEmail} failed to bind app managed certificate to hostname {sHostName}");
}
}
}
else
{
Log.Logger.Information($"{sUserEmail} failed to create app managed certificate for hostname {sHostName}");
return false;
}
}
else
{
Log.Logger.Information($"{sUserEmail} failed to create hostname {sHostName}");
return false;
}
return bRet;
}
After I execute the Thread.Sleep method, the app service starts shutting down. See the logs below:
2022-02-05 19:43:01.452 +00:00 [INF] email#gmail.com created hostname mysite
2022-02-05 19:43:06.322 +00:00 [INF] email#gmail.com created app managed certificate for hostname mysite
2022-02-05 19:43:06.323 +00:00 [INF] email#gmail.com starting 10 second wait
2022-02-05 19:43:07.368 +00:00 [INF] Request starting HTTP/1.1 GET http://myapp20211028195113.azurewebsites.net/ - -
2022-02-05 19:43:07.377 +00:00 [INF] Request finished HTTP/1.1 GET http://myapp20211028195113.azurewebsites.net/ - - - 307 - - 9.3353ms
2022-02-05 19:43:07.470 +00:00 [INF] Application is shutting down...
2022-02-05 19:43:12.492 +00:00 [INF] Scheduler DefaultQuartzScheduler_$_NON_CLUSTERED shutting down.
2022-02-05 19:43:12.496 +00:00 [INF] Scheduler DefaultQuartzScheduler_$_NON_CLUSTERED paused.
2022-02-05 19:43:12.508 +00:00 [INF] Scheduler DefaultQuartzScheduler_$_NON_CLUSTERED Shutdown complete.
2022-02-05 19:43:16.334 +00:00 [INF] email#gmail.com finish 10 second wait
2022-02-05 19:43:17.952 +00:00 [INF] email#gmail.com failed to bind app managed certificate to hostname mysite
2022-02-05 19:43:17.954 +00:00 [INF] email#gmail.com starting 10 second wait
2022-02-05 19:43:27.961 +00:00 [INF] email#gmail.com finish 10 second wait
2022-02-05 19:43:29.124 +00:00 [INF] email#gmail.com failed to bind app managed certificate to hostname mysite
2022-02-05 19:43:29.125 +00:00 [INF] email#gmail.com starting 10 second wait
2022-02-05 19:43:39.138 +00:00 [INF] email#gmail.com finish 10 second wait
2022-02-05 19:43:39.989 +00:00 [INF] email#gmail.com failed to bind app managed certificate to hostname mysite
2022-02-05 19:43:39.992 +00:00 [INF] email#gmail.com starting 10 second wait
2022-02-05 19:43:50.233 +00:00 [INF] email#gmail.com finish 10 second wait
2022-02-05 19:43:51.791 +00:00 [INF] email#gmail.com failed to bind app managed certificate to hostname mysite
2022-02-05 19:43:51.997 +00:00 [INF] email#gmail.com starting 10 second wait
2022-02-05 19:44:02.211 +00:00 [INF] email#gmail.com finish 10 second wait
2022-02-05 19:44:03.335 +00:00 [INF] email#gmail.com failed to bind app managed certificate to hostname mysite
2022-02-05 19:44:03.336 +00:00 [INF] email#gmail.com starting 10 second wait
2022-02-05 19:44:13.354 +00:00 [INF] email#gmail.com finish 10 second wait
2022-02-05 19:44:14.443 +00:00 [INF] email#gmail.com failed to bind app managed certificate to hostname mysite
2022-02-05 19:44:14.444 +00:00 [INF] email#gmail.com starting 10 second wait
2022-02-05 19:44:24.457 +00:00 [INF] email#gmail.com finish 10 second wait
2022-02-05 19:44:25.574 +00:00 [INF] email#gmail.com failed to bind app managed certificate to hostname mysite
2022-02-05 19:44:25.577 +00:00 [INF] email#gmail.com starting 10 second wait
Notice that after I start the first 10 second wait, the app starts to shut down. I have to assume it is because of Thread Sleep.
Should I use another approach? This works fine when I am debugging with Visual Studio, but I get this weird behavior only when running on Azure. Any help would be appreciated.
Thanks
Update: I ended up creating a Job to look for for certificates that are created and need to be bound.
I created 3 boolean fields in a table. 1 field holds the status of the domain being associated with the web app. 1 field holds the status of the certificate created. 1 field holds the status of the certificate being associated with the custom domain name.
Use Task.Delay(10000) instead of Thread.Sleep(10000).
Related
I have generated a SAS token from azure with the intention of using it to access a container within the storage account. I have left all the permissions, got every one of them ticked. The token got generated and I am using the code snippet below.
$TLS12Protocol = [System.Net.SecurityProtocolType] 'Ssl3 , Tls12'
[System.Net.ServicePointManager]::SecurityProtocol = $TLS12Protocol
$ctx = New-AzStorageContext -StorageAccountName "my-storage-account" -sastoken "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
get-azstoragecontainer -container "my-container" -Context $ctx -Debug
I get the error below, and I'm unsure as to what I'm missing.
x-ms-version:2021-06-08
Accept:application/xml
User-Agent:AzurePowershell/v1.0.0,azsdk-net-Storage.Blobs/12.12.0 (.NET Framework 4.8.4515.0; Microsoft Windows 10.0.19044 )
x-ms-client-request-id:abb66a91-xxxx-43e9-9391-xxxxxxxx
x-ms-return-client-request-id:true
client assembly: Azure.Storage.Blobs
DEBUG: Response [abb66a91-xxxx-43e9-9391-xxxxxxxx] 200 OK (00.1s)
x-ms-request-id:88fd2933-101e-0062-749d-35abda000000
x-ms-client-request-id:abb66a91-xxxx-43e9-9391-xxxxxxxx
x-ms-version:2021-06-08
x-ms-meta-hdi_version:REDACTED
x-ms-lease-status:unlocked
x-ms-lease-state:available
x-ms-has-immutability-policy:false
x-ms-has-legal-hold:false
x-ms-immutable-storage-with-versioning-enabled:REDACTED
x-ms-default-encryption-scope:$account-encryption-key
x-ms-deny-encryption-scope-override:false
Content-Length:0
Date:Tue, 31 Jan 2023 09:54:59 GMT
ETag:"0x8DA81EFF05B25D0"
Last-Modified:Fri, 19 Oct 2022 19:34:35 GMT
Server:Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
DEBUG: Request [dt45454-3b50-4ede-a572-dtrtrt] GET https://xxxxxxx.blob.core.windows.net/my-container?sv=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
x-ms-version:2021-06-08
Accept:application/xml
User-Agent:AzurePowershell/v1.0.0,azsdk-net-Storage.Blobs/12.12.0 (.NET Framework 4.8.4515.0; Microsoft Windows 10.0.19044 )
x-ms-client-request-id:dt45454-3b50-4ede-a572-dtrtrt
x-ms-return-client-request-id:true
client assembly: Azure.Storage.Blobs
DEBUG: Error response [dt45454-3b50-4ede-a572-dtrtrt] 403 This request is not authorized to perform this operation. (00.0s)
x-ms-request-id:fdsf7823f-101e-0062-079d-35abda1111
x-ms-client-request-id:dt45454-3b50-4ede-a572-dtrtrt
x-ms-version:2021-06-08
x-ms-error-code:AuthorizationFailure
Content-Length:246
Content-Type:application/xml
Date:Tue, 31 Jan 2023 09:54:59 GMT
Server:Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
Storage Account Name: my-storage-account
Name PublicAccess LastModified IsDeleted VersionId
---- ------------ ------------ --------- ---------
my-container 19/08/2022 14:34:35 +00:00
DEBUG: 09:54:57 - GetAzureStorageContainerCommand end processing, Start 0 remote calls. Finish 0 remote calls. Elapsed time 1148024.64 ms. Client operation id: Azure-Storage-PowerShell-.
DEBUG: AzureQoSEvent: Module: Az.Storage:4.6.0; CommandName: Get-AzStorageContainer; PSVersion: 5.1.19041.2364; IsSuccess: True; Duration: 00:00:00.1344053
DEBUG: Finish sending metric.
DEBUG: 09:54:57 - GetAzureStorageContainerCommand end processing.
The logs you've indicated above aren't errors; rather, they're logs debugging response you've been getting because of -DEBUG command. If you intend not to get any of such responses and to use the objects on azure blob container, you can remove -DEBUG and store the values of it into a variable. I used the same code as yours and got the below results without using debug:
I created an angular abp.io application. I mainly followed step for a blazor app in this tutorial. see tut. The db and api are hosted on azure. Everything runs correctly locally. The remote database is updated.
There are no CORS errors.
The logs.txt shows only successes since the last restart. (bottom)
The swagger page loads. However if I 'Try IT'/'Execute' any endpoint such as '{domain}.api/app/monitoring/series-one' which should just return a list of numbers... I receive '500 - Internal Server Error'.
2021-09-10 19:03:30.579 +00:00 [INF] Starting Vhb.AtlasAdmin.HttpApi.Host.
2021-09-10 19:03:36.216 +00:00 [INF] Azure Web Sites environment detected. Using 'C:\home\ASP.NET\DataProtection-Keys' as key repository; keys will not be encrypted at rest.
2021-09-10 19:03:36.427 +00:00 [INF] Loaded ABP modules:
2021-09-10 19:03:36.427 +00:00 [INF] - Vhb.AtlasAdmin.AtlasAdminHttpApiHostModule
2021-09-10 19:03:36.427 +00:00 [INF] - Vhb.AtlasAdmin.AtlasAdminHttpApiModule
2021-09-10 19:03:36.427 +00:00 [INF] - Vhb.AtlasAdmin.AtlasAdminApplicationContractsModule
2021-09-10 19:03:36.427 +00:00 [INF] - Vhb.AtlasAdmin.AtlasAdminDomainSharedModule
2021-09-10 19:03:36.427 +00:00 [INF] - Volo.Abp.AuditLogging.AbpAuditLoggingDomainSharedModule
2021-09-10 19:03:36.427 +00:00 [INF] - Volo.Abp.BackgroundJobs.AbpBackgroundJobsDomainSharedModule
2021-09-10 19:03:36.427 +00:00 [INF] - Volo.Abp.FeatureManagement.AbpFeatureManagementDomainSharedModule
2021-09-10 19:03:36.427 +00:00 [INF] - Volo.Abp.Validation.AbpValidationModule
2021-09-10 19:03:36.427 +00:00 [INF] - Volo.Abp.Validation.AbpValidationAbstractionsModule
2021-09-10 19:03:36.427 +00:00 [INF] - Volo.Abp.Localization.AbpLocalizationModule
2021-09-10 19:03:36.427 +00:00 [INF] - Volo.Abp.VirtualFileSystem.AbpVirtualFileSystemModule
2021-09-10 19:03:36.427 +00:00 [INF] - Volo.Abp.Settings.AbpSettingsModule
2021-09-10 19:03:36.427 +00:00 [INF] - Volo.Abp.Localization.AbpLocalizationAbstractionsModule
2021-09-10 19:03:36.427 +00:00 [INF] - Volo.Abp.Security.AbpSecurityModule
2021-09-10 19:03:36.427 +00:00 [INF] - Volo.Abp.MultiTenancy.AbpMultiTenancyModule
2021-09-10 19:03:36.427 +00:00 [INF] - Volo.Abp.Data.AbpDataModule
2021-09-10 19:03:36.427 +00:00 [INF] - Volo.Abp.ObjectExtending.AbpObjectExtendingModule
2021-09-10 19:03:36.427 +00:00 [INF] - Volo.Abp.Uow.AbpUnitOfWorkModule
2021-09-10 19:03:36.427 +00:00 [INF] - Volo.Abp.EventBus.Abstractions.AbpEventBusAbstractionsModule
2021-09-10 19:03:36.427 +00:00 [INF] - Volo.Abp.Identity.AbpIdentityDomainSharedModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.Users.AbpUsersDomainSharedModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.Features.AbpFeaturesModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.Authorization.AbpAuthorizationAbstractionsModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.IdentityServer.AbpIdentityServerDomainSharedModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.PermissionManagement.AbpPermissionManagementDomainSharedModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.SettingManagement.AbpSettingManagementDomainSharedModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.TenantManagement.AbpTenantManagementDomainSharedModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.Account.AbpAccountApplicationContractsModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.Identity.AbpIdentityApplicationContractsModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.Users.AbpUsersAbstractionModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.EventBus.AbpEventBusModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.Json.AbpJsonModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.Timing.AbpTimingModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.Authorization.AbpAuthorizationModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.PermissionManagement.AbpPermissionManagementApplicationContractsModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.Application.AbpDddApplicationContractsModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.Auditing.AbpAuditingModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.Threading.AbpThreadingModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.FeatureManagement.AbpFeatureManagementApplicationContractsModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.SettingManagement.AbpSettingManagementApplicationContractsModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.TenantManagement.AbpTenantManagementApplicationContractsModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.Account.AbpAccountHttpApiModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.Identity.AbpIdentityHttpApiModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.AspNetCore.Mvc.AbpAspNetCoreMvcModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.AspNetCore.AbpAspNetCoreModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.Http.AbpHttpModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.Http.AbpHttpAbstractionsModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.Minify.AbpMinifyModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.ExceptionHandling.AbpExceptionHandlingModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.ApiVersioning.AbpApiVersioningAbstractionsModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.AspNetCore.Mvc.AbpAspNetCoreMvcContractsModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.UI.Navigation.AbpUiNavigationModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.UI.AbpUiModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.GlobalFeatures.AbpGlobalFeaturesModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.Application.AbpDddApplicationModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.Domain.AbpDddDomainModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.Guids.AbpGuidsModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.ObjectMapping.AbpObjectMappingModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.Specifications.AbpSpecificationsModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.PermissionManagement.HttpApi.AbpPermissionManagementHttpApiModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.TenantManagement.AbpTenantManagementHttpApiModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.FeatureManagement.AbpFeatureManagementHttpApiModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.SettingManagement.AbpSettingManagementHttpApiModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.Autofac.AbpAutofacModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.Castle.AbpCastleCoreModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.AspNetCore.MultiTenancy.AbpAspNetCoreMultiTenancyModule
2021-09-10 19:03:36.428 +00:00 [INF] - Vhb.AtlasAdmin.AtlasAdminApplicationModule
2021-09-10 19:03:36.428 +00:00 [INF] - Vhb.AtlasAdmin.AtlasAdminDomainModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.AuditLogging.AbpAuditLoggingDomainModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.BackgroundJobs.AbpBackgroundJobsDomainModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.BackgroundJobs.AbpBackgroundJobsModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.BackgroundJobs.AbpBackgroundJobsAbstractionsModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.BackgroundWorkers.AbpBackgroundWorkersModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.AutoMapper.AbpAutoMapperModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.FeatureManagement.AbpFeatureManagementDomainModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.Caching.AbpCachingModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.Serialization.AbpSerializationModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.Identity.AbpIdentityDomainModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.Users.AbpUsersDomainModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.PermissionManagement.Identity.AbpPermissionManagementDomainIdentityModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.PermissionManagement.AbpPermissionManagementDomainModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.IdentityServer.AbpIdentityServerDomainModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.PermissionManagement.IdentityServer.AbpPermissionManagementDomainIdentityServerModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.SettingManagement.AbpSettingManagementDomainModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.TenantManagement.AbpTenantManagementDomainModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.Emailing.AbpEmailingModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.TextTemplating.AbpTextTemplatingModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.TextTemplating.Scriban.AbpTextTemplatingScribanModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.TextTemplating.AbpTextTemplatingCoreModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.Account.AbpAccountApplicationModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.Identity.AbpIdentityApplicationModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.PermissionManagement.AbpPermissionManagementApplicationModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.TenantManagement.AbpTenantManagementApplicationModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.FeatureManagement.AbpFeatureManagementApplicationModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.SettingManagement.AbpSettingManagementApplicationModule
2021-09-10 19:03:36.428 +00:00 [INF] - Vhb.AtlasAdmin.EntityFrameworkCore.AtlasAdminEntityFrameworkCoreModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.Identity.EntityFrameworkCore.AbpIdentityEntityFrameworkCoreModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.Users.EntityFrameworkCore.AbpUsersEntityFrameworkCoreModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.EntityFrameworkCore.AbpEntityFrameworkCoreModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.IdentityServer.EntityFrameworkCore.AbpIdentityServerEntityFrameworkCoreModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.PermissionManagement.EntityFrameworkCore.AbpPermissionManagementEntityFrameworkCoreModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.SettingManagement.EntityFrameworkCore.AbpSettingManagementEntityFrameworkCoreModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.EntityFrameworkCore.SqlServer.AbpEntityFrameworkCoreSqlServerModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.BackgroundJobs.EntityFrameworkCore.AbpBackgroundJobsEntityFrameworkCoreModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.AuditLogging.EntityFrameworkCore.AbpAuditLoggingEntityFrameworkCoreModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.TenantManagement.EntityFrameworkCore.AbpTenantManagementEntityFrameworkCoreModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.FeatureManagement.EntityFrameworkCore.AbpFeatureManagementEntityFrameworkCoreModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.AbpAspNetCoreMvcUiBasicThemeModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.AbpAspNetCoreMvcUiThemeSharedModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.AbpAspNetCoreMvcUiBootstrapModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.AspNetCore.Mvc.UI.AbpAspNetCoreMvcUiModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.AspNetCore.Mvc.UI.Packages.AbpAspNetCoreMvcUiPackagesModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.AspNetCore.Mvc.UI.Bundling.AbpAspNetCoreMvcUiBundlingAbstractionsModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.AspNetCore.Mvc.UI.Widgets.AbpAspNetCoreMvcUiWidgetsModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.AspNetCore.Mvc.UI.Bundling.AbpAspNetCoreMvcUiBundlingModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy.AbpAspNetCoreMvcUiMultiTenancyModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.AspNetCore.Authentication.JwtBearer.AbpAspNetCoreAuthenticationJwtBearerModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.Account.Web.AbpAccountWebIdentityServerModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.Account.Web.AbpAccountWebModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.Identity.AspNetCore.AbpIdentityAspNetCoreModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.AspNetCore.Serilog.AbpAspNetCoreSerilogModule
2021-09-10 19:03:36.428 +00:00 [INF] - Volo.Abp.Swashbuckle.AbpSwashbuckleModule
2021-09-10 19:03:36.624 +00:00 [DBG] Started background worker: Volo.Abp.BackgroundJobs.BackgroundJobWorker
2021-09-10 19:03:36.632 +00:00 [DBG] Started background worker: Volo.Abp.IdentityServer.Tokens.TokenCleanupBackgroundWorker
2021-09-10 19:03:36.652 +00:00 [INF] Starting IdentityServer4 version 4.1.1+cebd52f5bc61bdefc262fd20739d4d087c6f961f
2021-09-10 19:03:38.645 +00:00 [INF] Using the default authentication scheme Identity.Application for IdentityServer
2021-09-10 19:03:38.645 +00:00 [DBG] Using Identity.Application as default ASP.NET Core scheme for authentication
2021-09-10 19:03:38.645 +00:00 [DBG] Using Identity.External as default ASP.NET Core scheme for sign-in
2021-09-10 19:03:38.645 +00:00 [DBG] Using Identity.External as default ASP.NET Core scheme for sign-out
2021-09-10 19:03:38.645 +00:00 [DBG] Using Identity.Application as default ASP.NET Core scheme for challenge
2021-09-10 19:03:38.645 +00:00 [DBG] Using Identity.Application as default ASP.NET Core scheme for forbid
2021-09-10 19:03:39.668 +00:00 [INF] Initialized all ABP modules.
2021-09-10 19:03:39.806 +00:00 [INF] Now listening on: http://127.0.0.1:30125
2021-09-10 19:03:39.806 +00:00 [INF] Application started. Press Ctrl+C to shut down.
2021-09-10 19:03:39.806 +00:00 [INF] Hosting environment: Staging
2021-09-10 19:03:39.806 +00:00 [INF] Content root path: C:\home\site\wwwroot
2021-09-10 19:03:39.956 +00:00 [INF] Request starting HTTP/1.1 GET http://vhbatlasadmin2.azurewebsites.net/.well-known/openid-configuration - -
2021-09-10 19:03:44.407 +00:00 [INF] CORS policy execution successful.
2021-09-10 19:03:44.497 +00:00 [DBG] Login Url: /Account/Login
2021-09-10 19:03:44.497 +00:00 [DBG] Login Return Url Parameter: ReturnUrl
2021-09-10 19:03:44.497 +00:00 [DBG] Logout Url: /Account/Logout
2021-09-10 19:03:44.497 +00:00 [DBG] ConsentUrl Url: /Consent
2021-09-10 19:03:44.497 +00:00 [DBG] Consent Return Url Parameter: returnUrl
2021-09-10 19:03:44.497 +00:00 [DBG] Error Url: /Account/Error
2021-09-10 19:03:44.497 +00:00 [DBG] Error Id Parameter: errorId
2021-09-10 19:03:44.813 +00:00 [DBG] CORS request made for path: /.well-known/openid-configuration from origin: https://vhbatlasadminangular.azurewebsites.net
2021-09-10 19:03:45.612 +00:00 [DBG] CorsPolicyService allowed origin: https://vhbatlasadminangular.azurewebsites.net
2021-09-10 19:03:45.613 +00:00 [INF] CORS policy execution successful.
2021-09-10 19:03:45.634 +00:00 [DBG] Request path /.well-known/openid-configuration matched to endpoint type Discovery
2021-09-10 19:03:46.688 +00:00 [DBG] Endpoint enabled: Discovery, successfully created handler: IdentityServer4.Endpoints.DiscoveryEndpoint
2021-09-10 19:03:46.688 +00:00 [INF] Invoking IdentityServer endpoint: IdentityServer4.Endpoints.DiscoveryEndpoint for /.well-known/openid-configuration
2021-09-10 19:03:46.693 +00:00 [DBG] Start discovery request
2021-09-10 19:03:48.394 +00:00 [INF] Request finished HTTP/1.1 GET http://vhbatlasadmin2.azurewebsites.net/.well-known/openid-configuration - - - 200 - application/json;+charset=UTF-8 8437.7977ms
2021-09-10 19:03:48.487 +00:00 [INF] Request starting HTTP/1.1 GET http://vhbatlasadmin2.azurewebsites.net/.well-known/openid-configuration/jwks - -
2021-09-10 19:03:48.495 +00:00 [INF] CORS policy execution successful.
2021-09-10 19:03:48.504 +00:00 [DBG] CORS request made for path: /.well-known/openid-configuration/jwks from origin: https://vhbatlasadminangular.azurewebsites.net
2021-09-10 19:03:48.507 +00:00 [DBG] CorsPolicyService allowed origin: https://vhbatlasadminangular.azurewebsites.net
2021-09-10 19:03:48.507 +00:00 [INF] CORS policy execution successful.
2021-09-10 19:03:48.513 +00:00 [DBG] Request path /.well-known/openid-configuration/jwks matched to endpoint type Discovery
2021-09-10 19:03:48.524 +00:00 [DBG] Endpoint enabled: Discovery, successfully created handler: IdentityServer4.Endpoints.DiscoveryKeyEndpoint
2021-09-10 19:03:48.524 +00:00 [INF] Invoking IdentityServer endpoint: IdentityServer4.Endpoints.DiscoveryKeyEndpoint for /.well-known/openid-configuration/jwks
2021-09-10 19:03:48.525 +00:00 [DBG] Start key discovery request
2021-09-10 19:03:48.557 +00:00 [INF] Request finished HTTP/1.1 GET http://vhbatlasadmin2.azurewebsites.net/.well-known/openid-configuration/jwks - - - 200 - application/json;+charset=UTF-8 69.7467ms
This error was not related to the back-end code.
The azure app service configuration had a virtual-app/path-map that conflicted with the route. After removing this path-map the routes were able to respond correctly.
I am very new to web development and currently trying to deploy a Flask application on Microsoft Azure. The deployment is successful but the website loads for a very long time and then crashes...
The errors I get in the Application logs are as follows:
2020-04-24 11:05:10.813 INFO - Logging is not enabled for this container.
Please use https://aka.ms/linux-diagnostics to enable logging to see container logs here.
2020-04-24 11:05:14.160 INFO - Initiating warmup request to container <container name> for site <appname>
2020-04-24 11:05:29.738 INFO - Waiting for response to warmup request for container <container name>. Elapsed time = 15.5776184 sec
2020-04-24 11:05:46.605 INFO - Waiting for response to warmup request for container <container name>. Elapsed time = 32.4451731 sec
2020-04-24 11:06:02.843 INFO - Waiting for response to warmup request for container <container name>. Elapsed time = 48.6833158 sec
2020-04-24 11:06:20.077 INFO - Waiting for response to warmup request for container <container name>. Elapsed time = 65.9168483 sec
2020-04-24 11:06:35.755 INFO - Waiting for response to warmup request for container <container name>. Elapsed time = 81.5946978 sec
2020-04-24 11:06:51.273 INFO - Waiting for response to warmup request for container <container name>. Elapsed time = 97.1126494 sec
2020-04-24 11:07:06.740 INFO - Waiting for response to warmup request for container <container name>. Elapsed time = 112.5797427 sec
2020-04-24 11:07:22.295 INFO - Waiting for response to warmup request for container <container name>. Elapsed time = 128.1349342 sec
2020-04-24 11:09:28.785 ERROR - Container <container name> for site <appname> did not start within expected time limit. Elapsed time = 254.6249399 sec
2020-04-24 11:09:28.833 ERROR - Container <container name> didn't respond to HTTP pings on port: 8000, failing site start. See container logs for debugging.
2020-04-24 11:09:29.008 INFO - Stoping site <appname> because it failed during startup.
What am I missing?
In my main.py file I set app.run(debug=True); so no ports and hosts specified, is this ok?
In the Cloud Shell I set:
az webapp config appsettings set --resource-group <resource-group-name> --name <app-name> --settings WEBSITES_PORT=8000
Does anyone know where the problem is?
All the best,
snowe
Hosting your webapp on Azure App Service (Web App) you can only work with port 80 and 443. If you need custom port, you'll need to use Azure Virtual Machine to host your application
I'm using angular 7 as frontend and on the backend net core web api in a Azure App Service.
When I call an endpoint that requires authentication it works locally, but when it is deployed on azure through devops, only the public endpoints work but not the ones requiring authentication.
This is the error message i get in the console browser
Http failure response for https://mysite.azurewebsites.net/api/test/private: 401 Unauthorized
My Angular web api call to backend in AZure
public questsRead(quest_Id:string): Observable<IQuest_vmr>{
const apiUrlPath = this.baseUrlBackend+'api/Quest/QuestRead';
const obser = this.httpClient.get(apiUrlPath, {
headers: new HttpHeaders().set('Authorization', `Bearer ${this.auth0IdToken}`),
params: {
"quest_Id": quest_Id,
},
})
.map((response: IQuest_vmr) => response);
return obser;
}
This is the Startup in my web api app to run auth0 service
public static void ConfigureServices(IServiceCollection services, IConfiguration Configuration)
{
string auth0_Config_Domain = Configuration["Auth0:Domain"];
services.AddAuthentication(options =>
{
options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme;
}).AddJwtBearer(options =>
{
options.Authority = auth0_Config_Domain;
options.Audience = Configuration["Auth0:ApiIdentifier"];
options.TokenValidationParameters = new TokenValidationParameters()
{
ValidAudience = Configuration["Auth0:ValidAudience"],
ValidIssuer = auth0_Config_Domain
};
});
services.AddAuthorization(options =>
{
options.AddPolicy("read:messages", policy => policy.Requirements.Add(new HasScopeRequirement("read:messages", auth0_Config_Domain)));
});
// register the scope authorization handler
services.AddSingleton<IAuthorizationHandler, HasScopeHandler>();
}
Log from azure
2019-12-18 20:16:33.702 +00:00 [Information] Microsoft.AspNetCore.Hosting.Internal.WebHost: Request starting HTTP/1.1 GET https://dev-naodca-backend-webapi.azurewebsites.net/api/test/private
2019-12-18 20:16:33.702 +00:00 [Trace] Microsoft.AspNetCore.HostFiltering.HostFilteringMiddleware: All hosts are allowed.
2019-12-18 20:16:33.702 +00:00 [Warning] Microsoft.AspNetCore.Cors.Infrastructure.CorsService: The CORS protocol does not allow specifying a wildcard (any) origin and credentials at the same time. Configure the policy by listing individual origins if credentials needs to be supported.
2019-12-18 20:16:33.702 +00:00 [Debug] Microsoft.AspNetCore.Cors.Infrastructure.CorsService: The request has an origin header: 'https://dev-naodca-ui-angular.azurewebsites.net'.
2019-12-18 20:16:33.702 +00:00 [Information] Microsoft.AspNetCore.Cors.Infrastructure.CorsService: CORS policy execution successful.
2019-12-18 20:16:33.702 +00:00 [Debug] Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerHandler: AuthenticationScheme: Bearer was not authenticated.
2019-12-18 20:16:33.702 +00:00 [Trace] Microsoft.AspNetCore.HttpsPolicy.HstsMiddleware: Adding HSTS header to response.
2019-12-18 20:16:33.702 +00:00 [Debug] Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware: The request path /api/test/private does not match a supported file type
2019-12-18 20:16:33.702 +00:00 [Debug] Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware: The request path does not match the path filter
2019-12-18 20:16:33.702 +00:00 [Debug] Microsoft.AspNetCore.Routing.Matching.DfaMatcher: 1 candidate(s) found for the request path '/api/test/private'
2019-12-18 20:16:33.702 +00:00 [Debug] Microsoft.AspNetCore.Routing.Matching.DfaMatcher: Endpoint 'WebApiNetCoreBaseProject.Controllers.Api.TestController.Private (WebApiNetCoreBaseProject)' with route pattern 'api/Test/private' is valid for the request path '/api/test/private'
2019-12-18 20:16:33.702 +00:00 [Debug] Microsoft.AspNetCore.Routing.EndpointRoutingMiddleware: Request matched endpoint 'WebApiNetCoreBaseProject.Controllers.Api.TestController.Private (WebApiNetCoreBaseProject)'
2019-12-18 20:16:33.702 +00:00 [Information] Microsoft.AspNetCore.Routing.EndpointMiddleware: Executing endpoint 'WebApiNetCoreBaseProject.Controllers.Api.TestController.Private (WebApiNetCoreBaseProject)'
2019-12-18 20:16:33.702 +00:00 [Information] Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker: Route matched with {action = "Private", controller = "Test"}. Executing controller action with signature Microsoft.AspNetCore.Mvc.IActionResult Private() on controller WebApiNetCoreBaseProject.Controllers.Api.TestController (WebApiNetCoreBaseProject).
2019-12-18 20:16:33.702 +00:00 [Debug] Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker: Execution plan of authorization filters (in the following order): Microsoft.AspNetCore.Mvc.Authorization.AuthorizeFilter
2019-12-18 20:16:33.702 +00:00 [Debug] Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker: Execution plan of resource filters (in the following order): Microsoft.AspNetCore.Mvc.ViewFeatures.Internal.SaveTempDataFilter
2019-12-18 20:16:33.702 +00:00 [Debug] Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker: Execution plan of action filters (in the following order): Microsoft.AspNetCore.Mvc.ModelBinding.UnsupportedContentTypeFilter (Order: -3000), Microsoft.AspNetCore.Mvc.Infrastructure.ModelStateInvalidFilter (Order: -2000), WebApiNetCoreBaseProject.Configuration.Startup.Service_Authentication.CustomFilter_Authentication
2019-12-18 20:16:33.702 +00:00 [Debug] Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker: Execution plan of exception filters (in the following order): WebApiNetCoreBaseProject.Startup+MyExceptionFilter
2019-12-18 20:16:33.702 +00:00 [Debug] Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker: Execution plan of result filters (in the following order): Microsoft.AspNetCore.Mvc.ViewFeatures.Internal.SaveTempDataFilter, Microsoft.AspNetCore.Mvc.Infrastructure.ClientErrorResultFilter (Order: -2000)
2019-12-18 20:16:33.702 +00:00 [Trace] Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker: Authorization Filter: Before executing OnAuthorizationAsync on filter Microsoft.AspNetCore.Mvc.Authorization.AuthorizeFilter.
2019-12-18 20:16:33.702 +00:00 [Information] Microsoft.AspNetCore.Authorization.DefaultAuthorizationService: Authorization failed.
2019-12-18 20:16:33.702 +00:00 [Trace] Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker: Authorization Filter: After executing OnAuthorizationAsync on filter Microsoft.AspNetCore.Mvc.Authorization.AuthorizeFilter.
2019-12-18 20:16:33.702 +00:00 [Information] Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker: Authorization failed for the request at filter 'Microsoft.AspNetCore.Mvc.Authorization.AuthorizeFilter'.
2019-12-18 20:16:33.702 +00:00 [Trace] Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker: Always Run Result Filter: Before executing OnResultExecuting on filter Microsoft.AspNetCore.Mvc.Infrastructure.ClientErrorResultFilter.
2019-12-18 20:16:33.702 +00:00 [Trace] Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker: Always Run Result Filter: After executing OnResultExecuting on filter Microsoft.AspNetCore.Mvc.Infrastructure.ClientErrorResultFilter.
2019-12-18 20:16:33.702 +00:00 [Trace] Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker: Before executing action result Microsoft.AspNetCore.Mvc.ChallengeResult.
2019-12-18 20:16:33.702 +00:00 [Information] Microsoft.AspNetCore.Mvc.ChallengeResult: Executing ChallengeResult with authentication schemes ().
2019-12-18 20:16:33.703 +00:00 [Information] Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerHandler: AuthenticationScheme: Bearer was challenged.
2019-12-18 20:16:33.703 +00:00 [Trace] Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker: After executing action result Microsoft.AspNetCore.Mvc.ChallengeResult.
2019-12-18 20:16:33.703 +00:00 [Trace] Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker: Always Run Result Filter: Before executing OnResultExecuted on filter Microsoft.AspNetCore.Mvc.Infrastructure.ClientErrorResultFilter.
2019-12-18 20:16:33.703 +00:00 [Trace] Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker: Always Run Result Filter: After executing OnResultExecuted on filter Microsoft.AspNetCore.Mvc.Infrastructure.ClientErrorResultFilter.
2019-12-18 20:16:33.703 +00:00 [Information] Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker: Executed action WebApiNetCoreBaseProject.Controllers.Api.TestController.Private (WebApiNetCoreBaseProject) in 0.4337ms
2019-12-18 20:16:33.703 +00:00 [Information] Microsoft.AspNetCore.Routing.EndpointMiddleware: Executed endpoint 'WebApiNetCoreBaseProject.Controllers.Api.TestController.Private (WebApiNetCoreBaseProject)'
2019-12-18 20:16:33.703 +00:00 [Information] Microsoft.AspNetCore.Hosting.Internal.WebHost: Request finished in 1.3235ms 401
From fiddler it turns out the the Auth0 JWT token was was sending from angular to the wepapi a wrong audience.
HTTP/1.1 401 Unauthorized
Date: Fri, 20 Dec 2019 10:28:18 GMT
Server: Kestrel
Content-Length: 0
Vary: Origin
WWW-Authenticate: Bearer error="invalid_token", error_description="The audience is invalid"
Access-Control-Allow-Credentials: true
Access-Control-Allow-Origin: *
Plus the angular html interceptor was not adding the JWT token for the private request at every call, thus I had to add it manually for that specific request and all the others.
I have a repository that uses application insights to log information about our services running in asp.net. We have some ASP.NET Core 2.0 sites along with some full framework asp.net 4 applications. With the release of application insights 2.5, we get support for live streaming in core sites so I upgraded all packages in the solution to use latest 2.5. Then I built the branch and deployed it via VSTS build and release and I noticed my live streaming was working great. Then, I released the previous build with the older 2.4 packages. Now, that environment is broken and none of the core sites will start anymore and I get this error.
An error occurred while starting the application.
.NET Core 4.6.26020.03 X86 v4.0.0.0 | Microsoft.AspNetCore.Hosting version 2.0.0-rtm-26452 | Microsoft Windows 10.0.14393 | Need help?
In the application logs, I'm seeing
[Critical] Microsoft.AspNetCore.Hosting.Internal.WebHost: Application startup exception
System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.AI.ServerTelemetryChannel, Version=2.5.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.
and
[Critical] Microsoft.AspNetCore.Hosting.Internal.WebHost: Hosting startup assembly exception
System.InvalidOperationException: Startup assembly Microsoft.AspNetCore.AzureKeyVault.HostingStartup failed to execute. See the inner exception for more details. ---> System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.AspNetCore.AzureKeyVault.HostingStartup, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.
Here's the full error response:
2018-03-05 18:34:13.783 +00:00 [Critical] Microsoft.AspNetCore.Hosting.Internal.WebHost: Application startup exception
System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.AI.ServerTelemetryChannel, Version=2.5.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.
File name: 'Microsoft.AI.ServerTelemetryChannel, Version=2.5.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
at Microsoft.Extensions.DependencyInjection.TelemetryConfigurationOptionsSetup.AddTelemetryChannelAndProcessors(TelemetryConfiguration configuration)
at Microsoft.Extensions.DependencyInjection.TelemetryConfigurationOptionsSetup.Configure(TelemetryConfiguration configuration)
at Microsoft.Extensions.DependencyInjection.TelemetryConfigurationOptions..ctor(IEnumerable`1 configureOptions)
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(IServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitSingleton(SingletonCallSite singletonCallSite, ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(IServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceProvider.<>c__DisplayClass22_0.<RealizeService>b__0(ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type serviceType)
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetService[T](IServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ApplicationInsightsExtensions.<>c.<AddApplicationInsightsTelemetry>b__13_1(IServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitFactory(FactoryCallSite factoryCallSite, ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(IServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitSingleton(SingletonCallSite singletonCallSite, ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(IServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(IServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitSingleton(SingletonCallSite singletonCallSite, ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(IServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(IServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitSingleton(SingletonCallSite singletonCallSite, ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(IServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitIEnumerable(IEnumerableCallSite enumerableCallSite, ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(IServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(IServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitSingleton(SingletonCallSite singletonCallSite, ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(IServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceProvider.<>c__DisplayClass22_0.<RealizeService>b__0(ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type serviceType)
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetService[T](IServiceProvider provider)
at Microsoft.ApplicationInsights.AspNetCore.ApplicationInsightsStartupFilter.<>c__DisplayClass0_0.<Configure>b__0(IApplicationBuilder app)
at Microsoft.AspNetCore.Server.IISIntegration.IISSetupFilter.<>c__DisplayClass3_0.<Configure>b__0(IApplicationBuilder app)
at Microsoft.AspNetCore.Hosting.Internal.AutoRequestServicesStartupFilter.<>c__DisplayClass0_0.<Configure>b__0(IApplicationBuilder builder)
at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()
2018-03-05 18:34:13.902 +00:00 [Debug] Microsoft.AspNetCore.Hosting.Internal.WebHost: Hosting starting
2018-03-05 18:34:14.273 +00:00 [Debug] Microsoft.AspNetCore.Server.Kestrel: Connection id "0HLC2OUP34I4I" started.
2018-03-05 18:34:14.354 +00:00 [Debug] Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv: Connection id "0HLC2OUP34I4I" received FIN.
2018-03-05 18:34:14.354 +00:00 [Debug] Microsoft.AspNetCore.Server.Kestrel: Connection id "0HLC2OUP34I4I" disconnecting.
2018-03-05 18:34:14.355 +00:00 [Debug] Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv: Connection id "0HLC2OUP34I4I" sending FIN.
2018-03-05 18:34:14.519 +00:00 [Debug] Microsoft.AspNetCore.Server.Kestrel: Connection id "0HLC2OUP34I4I" stopped.
2018-03-05 18:34:14.521 +00:00 [Debug] Microsoft.AspNetCore.Hosting.Internal.WebHost: Hosting started
2018-03-05 18:34:14.521 +00:00 [Debug] Microsoft.AspNetCore.Hosting.Internal.WebHost: Loaded hosting startup assembly **redacted**
2018-03-05 18:34:14.521 +00:00 [Debug] Microsoft.AspNetCore.Hosting.Internal.WebHost: Loaded hosting startup assembly Microsoft.AspNetCore.AzureAppServices.HostingStartup
2018-03-05 18:34:14.521 +00:00 [Debug] Microsoft.AspNetCore.Hosting.Internal.WebHost: Loaded hosting startup assembly Microsoft.AspNetCore.AzureKeyVault.HostingStartup
2018-03-05 18:34:14.521 +00:00 [Debug] Microsoft.AspNetCore.Hosting.Internal.WebHost: Loaded hosting startup assembly Microsoft.AspNetCore.Server.IISIntegration
2018-03-05 18:34:14.547 +00:00 [Critical] Microsoft.AspNetCore.Hosting.Internal.WebHost: Hosting startup assembly exception
System.InvalidOperationException: Startup assembly Microsoft.AspNetCore.AzureKeyVault.HostingStartup failed to execute. See the inner exception for more details. ---> System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.AspNetCore.AzureKeyVault.HostingStartup, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.
at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks, IntPtr ptrLoadContextBinder)
at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, IntPtr ptrLoadContextBinder)
at System.Reflection.Assembly.Load(AssemblyName assemblyRef)
at Microsoft.AspNetCore.Hosting.WebHostBuilder.BuildCommonServices(AggregateException& hostingStartupErrors)
--- End of inner exception stack trace ---
2018-03-05 18:34:14.699 +00:00 [Debug] Microsoft.AspNetCore.Server.Kestrel: Connection id "0HLC2OUP34I4J" started.
2018-03-05 18:34:15.295 +00:00 [Information] Microsoft.AspNetCore.Hosting.Internal.WebHost: Request starting HTTP/1.1 GET http://localhost/
2018-03-05 18:34:15.325 +00:00 [Debug] Microsoft.AspNetCore.Server.Kestrel: Connection id "0HLC2OUP34I4J" completed keep alive response.
2018-03-05 18:34:15.326 +00:00 [Information] Microsoft.AspNetCore.Hosting.Internal.WebHost: Request finished in 30.3157ms 500 text/html; charset=utf-8
2018-03-05 18:34:15.353 +00:00 [Debug] Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv: Connection id "0HLC2OUP34I4J" reset.
2018-03-05 18:34:15.353 +00:00 [Debug] Microsoft.AspNetCore.Server.Kestrel: Connection id "0HLC2OUP34I4J" disconnecting.
2018-03-05 18:34:15.358 +00:00 [Debug] Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv: Connection id "0HLC2OUP34I4J" sending FIN.
2018-03-05 18:34:15.370 +00:00 [Debug] Microsoft.AspNetCore.Server.Kestrel: Connection id "0HLC2OUP34I4K" started.
2018-03-05 18:34:15.372 +00:00 [Debug] Microsoft.AspNetCore.Server.Kestrel: Connection id "0HLC2OUP34I4L" started.
2018-03-05 18:34:15.372 +00:00 [Debug] Microsoft.AspNetCore.Server.Kestrel: Connection id "0HLC2OUP34I4J" stopped.
2018-03-05 18:34:15.381 +00:00 [Information] Microsoft.AspNetCore.Hosting.Internal.WebHost: Request starting HTTP/1.1 GET http://***.azurewebsites.net/
2018-03-05 18:34:15.382 +00:00 [Debug] Microsoft.AspNetCore.Server.Kestrel: Connection id "0HLC2OUP34I4L" completed keep alive response.
2018-03-05 18:34:15.382 +00:00 [Information] Microsoft.AspNetCore.Hosting.Internal.WebHost: Request finished in 1.5282ms 500 text/html; charset=utf-8
2018-03-05 18:34:15.382 +00:00 [Information] Microsoft.AspNetCore.Hosting.Internal.WebHost: Request starting HTTP/1.1 GET http://***.***.com/api/health/all
2018-03-05 18:34:15.383 +00:00 [Debug] Microsoft.AspNetCore.Server.Kestrel: Connection id "0HLC2OUP34I4K" completed keep alive response.
2018-03-05 18:34:15.383 +00:00 [Information] Microsoft.AspNetCore.Hosting.Internal.WebHost: Request finished in 0.7699ms 500 text/html; charset=utf-8
2018-03-05 18:34:15.469 +00:00 [Debug] Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv: Connection id "0HLC2OUP34I4L" reset.
2018-03-05 18:34:15.469 +00:00 [Debug] Microsoft.AspNetCore.Server.Kestrel: Connection id "0HLC2OUP34I4L" disconnecting.
2018-03-05 18:34:15.469 +00:00 [Debug] Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv: Connection id "0HLC2OUP34I4L" sending FIN.
2018-03-05 18:34:15.470 +00:00 [Debug] Microsoft.AspNetCore.Server.Kestrel: Connection id "0HLC2OUP34I4L" stopped.
Try doing this (note this is usint .NET CLI you can use equivalent in powershell or package manager).
dotnet add package Microsoft.AspNetCore.AzureKeyVault.HostingStartup --version 2.1.0-preview1-27946 --source https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json
For some reason azure is referencing this package, even if you not using it.
It also prevents number of other services from launching as i found out including AppInsights.
This will create a dirty project as it is designed for core 2.1 not core 2.0 (doesn't exist in it).
But it should work without any issues (at least it did for 2 of my projects).