Azure / azure-libraries-for-net

Azure libraries for .Net
MIT License
379 stars 193 forks source link

[BUG] deploy the .war file to the appservice using Deploy().WithPackageUri(packageUrl) .WithExistingDeploymentsDeleted(true).Execute(); throws error #1157

Open vinuvinod opened 3 years ago

vinuvinod commented 3 years ago

Describe the bug I am trying trying to deploy the .war file to the appservice using azureInstance.WebApps.GetById(webAppId).Deploy().WithPackageUri(packageUrl) .WithExistingDeploymentsDeleted(true).Execute(); but it always returns same error as pasted below.

Exception or Stack Trace Source: Microsoft.Rest.ClientRuntime Message: The operation was canceled. InnerException: Unable to read data from the transport connection: The I/O operation has been aborted because of either a thread exit or an application request.. at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken) at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.GetResult(Int16 token) at System.Net.Security.SslStream.<g__InternalFillBufferAsync|215_0>d1.MoveNext() at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Net.Security.SslStream.<ReadAsyncInternal>d__2141.MoveNext() at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Net.Http.HttpConnection.d87.MoveNext() at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Net.Http.HttpConnection.d84.MoveNext() at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Net.Http.HttpConnection.d53.MoveNext() at Microsoft.Rest.RetryDelegatingHandler.d15.MoveNext() at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter1.GetResult() at Microsoft.Azure.Management.ResourceManager.Fluent.Core.ProviderRegistrationDelegatingHandler.<SendAsync>d__4.MoveNext() at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter1.GetResult() at Microsoft.Azure.Management.ResourceManager.Fluent.Core.UserAgentDelegatingHandler.d5.MoveNext() at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Net.Http.HttpClient.d70.MoveNext() at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1.ConfiguredTaskAwaiter.GetResult() at Microsoft.Azure.Management.AppService.Fluent.WebAppsOperations.<BeginCreateMSDeployOperationWithHttpMessagesAsync>d__355.MoveNext() at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1.ConfiguredTaskAwaiter.GetResult() at Microsoft.Azure.Management.AppService.Fluent.WebAppsOperations.d67.MoveNext() at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult() at Microsoft.Azure.Management.AppService.Fluent.WebAppsOperationsExtensions.d62.MoveNext() at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter1.GetResult() at Microsoft.Azure.Management.AppService.Fluent.AppServiceBaseImpl6.d50.MoveNext() at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter1.GetResult() at Microsoft.Azure.Management.AppService.Fluent.WebDeploymentImpl5.d29.MoveNext() at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter1.GetResult() at Microsoft.Azure.Management.ResourceManager.Fluent.Core.Extensions.Synchronize[TResult](Func1 function) at Microsoft.Azure.Management.ResourceManager.Fluent.Core.ResourceActions.Executable`1.Execute()

To Reproduce Steps to reproduce the behavior:

Code Snippet azureInstance.WebApps.GetById(webAppId).Deploy().WithPackageUri(packageUrl) .WithExistingDeploymentsDeleted(true).Execute();

weidongxu-microsoft commented 3 years ago

@vinuvinod

Would you try IWebApp.WarDeploy?

If it still fail, could you give us more details like SDK version (1.37?), web app OS (windows or linux), sample of the link to war (it need public visible, you can redact it if needed).

vinuvinod commented 3 years ago

Hi @weidongxu-microsoft I am using Windows as webapp OS and the sdk version is 1.34, and the war file is am taking it from storage account with a sas provided, and i have tried using IWebApp.WarDeploy am getting the same issue.

weidongxu-microsoft commented 3 years ago

@vinuvinod

Would you re-check on the accessibility of the package? I seems having no trouble doing this:

            var webapp = azure.WebApps.Define("wa1-weidxu")
                .WithRegion(Region.USCentral)
                .WithExistingResourceGroup("rg-weidxu")
                .WithNewWindowsPlan(PricingTier.BasicB1)
                .WithJavaVersion(JavaVersion.V8Newest)
                .WithWebContainer(WebContainer.Tomcat8_5Newest)
                .WithHttpsOnly(true)
                .Create();

            webapp.Deploy()
                .WithPackageUri("https://sa1weidxu.blob.core.windows.net/container1/helloworld.war?sp=REDACT")
                .WithExistingDeploymentsDeleted(true)
                .Execute();

Response:

{
  "id": "/subscriptions/ec0aa5f7-9e78-40c9-85cd-535c6305b380/resourceGroups/rg-weidxu/providers/Microsoft.Web/sites/wa1-weidxu/extensions/MSDeploy",
  "name": "MSDeploy",
  "type": "Microsoft.Web/sites/extensions",
  "location": "Central US",
  "properties": {
    "deployer": "EDB0C694F68FB1AC109AB0AE21C710971F8AFBC3",
    "provisioningState": "succeeded",
    "startTime": "2020-10-31T19:15:07.525068+08:00",
    "endTime": "2020-10-31T19:15:09.0454572+08:00",
    "complete": true
  }
}

Also, if you can enable logging and attach the log, it will help a lot. Please have the bearer token redacted.