0

I am able to run my containers locally. I published them to container registry. And the deployment from container registry to web apps for containers is successful.

But the service does not turn online. It says : 'did not start within expected time limit.'

App hangs like this enter image description here

After a while, it turns into: Service Unavailable

Implemented the web port settings In the documentation it says: 'In APPLICATION SETTINGS you need to set the key / value pair WEBSITES_PORT.' enter image description here

In ms documentation for web app for containers it states : We can only expose one port to outside world. When I set WEBSITES_PORT to 5001. I think that is internal and I would browse from 80.

The container log in web app for containers is ( After enabling logs in web app for containers )

> 2018_07_19_RD00155D8969ED_default_docker.log:
> 
> 2018-07-19T08:34:51.702905938Z [40m[1m[33mwarn[39m[22m[49m:
> Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35]
> 2018-07-19T08:34:51.703067037Z       No XML encryptor configured. Key
> {ae8ea8d7-d363-43f6-9fad-9d0b47070975} may be persisted to storage in
> unencrypted form. 2018-07-19T08:34:56.136551882Z
> [40m[1m[33mwarn[39m[22m[49m:
> Microsoft.AspNetCore.Server.Kestrel[0] 2018-07-19T08:34:56.136606682Z 
> Overriding address(es) 'http://+:80'. Binding to endpoints defined in
> UseKestrel() instead. 2018-07-19T08:34:56.189332291Z Hosting
> environment: Production 2018-07-19T08:34:56.189484090Z Content root
> path: /app 2018-07-19T08:34:56.189692188Z Now listening on:
> https://0.0.0.0:5001 2018-07-19T08:34:56.189778688Z Application
> started. Press Ctrl+C to shut down.
> 
> 2018_07_19_RD00155D8969ED_docker.log: 2018-07-19 08:30:52.045 INFO  -
> docker run -d -p 20436:5001 --name xxxdevinstrumentationservices_0 -e
> DOCKER_CUSTOM_IMAGE_NAME=xxxregistry.azurecr.io/integrationservices:317
> -e WEBSITES_ENABLE_APP_SERVICE_STORAGE=false -e WEBSITES_PORT=5001 -e WEBSITE_SITE_NAME=xxxdevinstrumentationservices -e
> WEBSITE_AUTH_ENABLED=False -e WEBSITE_ROLE_INSTANCE_ID=0 -e
> WEBSITE_INSTANCE_ID=a9154deab5b05a41585229b9d1fa00aee3bf0b3ab58f23a45d851ca3676d38d2
> -e HTTP_LOGGING_ENABLED=1 trnregistry.azurecr.io/integrationservices:317  
> 
> 2018-07-19 08:34:44.675 ERROR - Container
> xxxdevinstrumentationservices_0 for site xxxdevinstrumentationservices
> did not start within expected time limit. Elapsed time = 230.5807023
> sec 2018-07-19 08:34:46.652 INFO  - Starting container for site
> 2018-07-19 08:34:46.653 INFO  - docker run -d -p 30916:5001 --name
> trndevinstrumentationservices_1 -e
> DOCKER_CUSTOM_IMAGE_NAME=xxxregistry.azurecr.io/integrationservices:317
> -e WEBSITES_ENABLE_APP_SERVICE_STORAGE=false -e WEBSITES_PORT=5001 -e WEBSITE_SITE_NAME=trndevinstrumentationservices -e
> WEBSITE_AUTH_ENABLED=False -e WEBSITE_ROLE_INSTANCE_ID=0 -e
> WEBSITE_INSTANCE_ID=a9154deab5b05a41585229b9d1fa00aee3bf0b3ab58f23a45d851ca3676d38d2
> -e HTTP_LOGGING_ENABLED=1 xxxregistry.azurecr.io/integrationservices:317  
> 
> 2018-07-19 08:38:39.222 ERROR - Container
> xxxdevinstrumentationservices_1 for site xxxdevinstrumentationservices
> did not start within expected time limit. Elapsed time = 230.372819
> sec 2018-07-19 08:41:02.135 INFO  - Starting container for site
> 2018-07-19 08:41:02.138 INFO  - docker run -d -p 12003:5001 --name
> xxxdevinstrumentationservices_0 -e
> DOCKER_CUSTOM_IMAGE_NAME=trnregistry.azurecr.io/integrationservices:317
> -e WEBSITES_ENABLE_APP_SERVICE_STORAGE=false -e WEBSITES_PORT=5001 -e WEBSITE_SITE_NAME=xxxdevinstrumentationservices -e
> WEBSITE_AUTH_ENABLED=False -e WEBSITE_ROLE_INSTANCE_ID=0 -e
> WEBSITE_INSTANCE_ID=a9154deab5b05a41585229b9d1fa00aee3bf0b3ab58f23a45d851ca3676d38d2
> -e HTTP_LOGGING_ENABLED=1 xxxregistry.azurecr.io/integrationservices:317

Program code that starts the containers at 5001

>     public static class Program
>     {
>         public static void Main(string[] args)
>         {
>             BuildWebHost(args).Run();
>         }
> 
>         public static IWebHost BuildWebHost(string[] args)
>         {
>             // Temporary config - CORE 2.1 will make this redundant with UseKestrel(context, options)
>             var builder = new ConfigurationBuilder()
>                 .AddJsonFile("appsettings.json")
>                 .AddUserSecrets<Startup>();
>             var config = builder.Build();
> 
>             return WebHost.CreateDefaultBuilder(args)
>                 .UseStartup<Startup>()
>                 .UseKestrel(ko =>
>                 {
>                     var port = 5001;
>                     if (int.TryParse(config["SslPort"], out var p))
>                         port = p;
> 
>                     var sslCertificateLocation = config["SslCertificateLocation"];
>                     if (!File.Exists(sslCertificateLocation))
>                         throw new FileNotFoundException($"The SSL Certificate located at '{sslCertificateLocation}' could not be
> found!");
> 
>                     ko.Listen(IPAddress.Any, port, lo =>
>                      {
>                          lo.UseHttps(sslCertificateLocation, config["SslCertificatePassword"]);
>                      });
>                 })
>                 .Build();
>         }
>     }

Side note: We included our certificate file in your application directory and load it directly. https://docs.microsoft.com/en-gb/azure/app-service/app-service-web-ssl-cert-load#file

Web App For Containers Reference : https://blogs.msdn.microsoft.com/waws/2017/09/08/things-you-should-know-web-apps-and-linux/

A Reference that looks similar https://omgdebugging.com/2017/12/23/azure-web-app-for-container-failing-site-start/

Found the error which is related to SSL.Still i can not debug this. These log files are useless... enter image description here

  • I don't think someone can guess what happens in your container, the error is quite clear: " ERROR - Container > xxxdevinstrumentationservices_0 for site xxxdevinstrumentationservices > did not start within expected time limit." – Tensibai Jul 19 '18 at 8:56
  • how can i debug that ? – Rıfat Erdem Sahin Jul 19 '18 at 9:05
  • updated the question in that fashion. I am unable to see what is wrong as it runs locally. – Rıfat Erdem Sahin Jul 19 '18 at 9:12
  • Get your container logs, you need to configure webapp containers settings to access them: docs.microsoft.com/en-us/azure/app-service/containers/… – Tensibai Jul 19 '18 at 9:20
  • is this not the same thing where i enable them using the azure portal ui ? As i mentioned filesystem and retention there. and i can see these logs – Rıfat Erdem Sahin Jul 19 '18 at 9:58

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.