Azure cloud service deployment fails if i do not stop cloud service (classic) in my azure portal

1k Views Asked by At

I have a cloud service in my visual studio which contains a worker role with two instances. I have deployed using my CD in vsts which takes the build from my Cloud-CI pipeline.

My deployment is failing if i keep running my cloud service in my Azure Portal. Error:

BadRequest : Your role instances have recycled a number of times during an update or upgrade operation. This indicates that the new version of your service or the configuration settings you provided when configuring the service prevent the role instances from running. Verify your code does not throw unhandled exceptions and that your configuration settings are correct and then start another update or upgrade operation.

My deployment is success if i keep stopping my cloud service in my Azure Portal.

I am unable to find the main issue why it is failing and will i have to stop the Azure cloud service (classic) every time before the deployment?

2

There are 2 best solutions below

1
Sajeetharan On

We faced the same issue, anyway it's better to stop your service and start it again as there could be configuration changes.

You could add a new release task to stop the site in prior to all other tasks.

0
Ashish-BeJovial On

I have resolved my issue by fixing cscfg file of Staging. I have hard coded the values of all settings from my hosted environment and hosted again on Azure portal if my BlueSky Service.

Due to my bad config my roles in azure portal showing following issue, and for resolving this issue i diagnosed within my cloud service in Azure portal.

Error Message in Azure Portal

Recovering role... Application startup task "E:\approot\Startup.cmd" is running. [2019-02-01T09:07:42Z] Last exit time: [2019/02/01, 09:06:59.666]. Last exit code: 0. Last role exception: Microsoft.WindowsAzure.Storage.StorageException, Details: Exception: Unable to connect to the remote server at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteSync[T](RESTCommand`1 cmd, IRetryPolicy policy, OperationContext operationContext) at Microsoft.WindowsAzure.Storage.Table.CloudTable.Create(TableRequestOptions requestOptions, OperationContext operationContext) at Microsoft.WindowsAzure.Storage.Table.CloudTable.CreateIfNotExists(TableRequestOptions requestOptions, OperationContext operationContext) at Ascend.Azure.Extensions.CloudTableClientExtensions.CreateTableAndSchemaIfNotExist(CloudTableClient tableClient, String entitySetName, ITableEntity entity) at BlueSky.Azure.Storage.AzureTableStorageInitializer.InitializeTableStorage() at BlueSky.Azure.KernelModule.Load() at Ninject.KernelBase.Load(IEnumerable`1 m) at BlueSky.Cloud.Worker.NinjectBootstrapper.RegisterServices(StandardKernel kernel) at BlueSky.Cloud.Worker.NinjectBootstrapper.CreateKernel() at System.Lazy`1.CreateValue() at System.Lazy`1.LazyInitValue() at BlueSky.Cloud.Worker.NinjectBootstrapper.get_Kernel() at BlueSky.Cloud.Worker.WorkerRole.OnStart() at Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.InitializeRoleInternal(RoleType roleTypeEnum) at Microsoft.WindowsAzure.ServiceRuntime.Implementation.Loader.RoleRuntimeBridge.<InitializeRole>b__0() at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart() Inner Exception: Unable to connect to the remote server at System.Net.HttpWebRequest.GetRequestStream(TransportContext& context) at System.Net.HttpWebRequest.GetRequestStream() at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteSync[T](RESTCommand`1 cmd, IRetryPolicy policy, OperationContext operationContext) Inner Exception: No connection could be made because the target machine actively refused it 127.0.0.1:10002 at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress) at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception) '.