Closed camerow closed 7 months ago
That's odd. Does the same work if you just drag and drop your same zip into Kudu console (in the special zip drop area) while under d:\home\site?
Drag and drop works. So we must be making our request improperly. I notice
the form headers on DnD are x-www-url-formencoded
while ours is
multipart-form-data
. Could that explain odd behavior?
On Fri, Oct 14, 2016, 2:35 PM David Ebbo notifications@github.com wrote:
That's odd. Does the same work if you just drag and drop your same zip into Kudu console (in the special zip drop area) while under d:\home\site?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/projectkudu/kudu/issues/2179#issuecomment-253925289, or mute the thread https://github.com/notifications/unsubscribe-auth/AD9k4mVe6eBc3LE1ra2_EJExxo4A7hgeks5qz_V6gaJpZM4KXcsw .
I'm not sure if the content type matters here, as Kudu likely ignores it.
But the fact that it works for you in DnD but not PowerShell makes it sound a lot like #1448, except in that case it was download and you're doing upload.
Can you check whether upload works for you with curl? Not the curl Posh alias, but the real curl.
Although the specific error that you get really doesn't make sense and looks unrelated to that other issue. Does it happen if you go to a different folder? What about with a trivial zip file? Maybe there are other difference in the way you make your request?
(EDIT: Wrote in browser for markdown support) Here's our current rest call just in case that helps:
$apiURL = "https://oursite.scm.azurewebsites.net/api/zip/site"
$filePath = "./path/to/myzip.zip"
Invoke-RestMethod -Uri $apiURL -DisableKeepAlive -TimeoutSec 600 -Headers
@{Authorization=("Basic {0}" -f $base64AuthInfo)} -Method PUT -InFile
$filePath -ContentType "application/zip"
I'll work on trying different folders, trivial zip file etc.
We actually have a sample on https://github.com/projectkudu/kudu/wiki/REST-API#sample-of-using-rest-api-with-powershell as well if you want to compare.
So far I've tried:
ContentType "multipart/form-data"
(as per example) & ContentType "application/zip"
UserAgent "powershell/3.0"
(as per example)It seems to be a destination problem, though I could definitely be wrong on that. Nothing with this path: "https://{site-slot}.scm.azurewebsites.net/api/zip/site"
stands out as invalid to me though. I'm not super great with Powershell so I'm sure there is some user error happening here as well, but struggling to find it.
Thanks for your help so far!
Getting a similar issue when I do a POST
Function d3-JoinParts { param ([string[]] $Parts, [string] $Separator = '/')
$search = '(?<!:)' + [regex]::Escape($Separator) + '+' #Replace multiples except in front of a colon for URLs.
$replace = $Separator
($Parts | ? {$_ -and $_.Trim().Length}) -join $Separator -replace $search, $replace
}
$destinationPath = "/site/wwwroot" $baseUrl = "https://" + $siteName + ".scm.azurewebsites.net" $apiUrl = d3-JoinParts ($baseUrl, "api/zip", $destinationPath) '/'
Invoke-RestMethod -Uri $apiUrl -Headers @{Authorization=("Basic {0}" -f $base64AuthInfo)} -Method PUT -InFile $sourceZipFile -ContentType "multipart/form-data" -TimeoutSec $timeOutSec
denied.","ExceptionType":"System.UnauthorizedAccessException","StackTrace":" at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)\r\n at System.IO.FileStream.WriteCore(Byte[] buffer, Int32 offset, Int32 count)\r\n at System.IO.FileStream.FlushWrite(Boolean calledFromFinalizer)\r\n at System.IO.FileStream.Dispose(Boolean
disposing)\r\n at System.IO.Stream.Close()\r\n at System.IO.Stream.Dispose()\r\n at
Kudu.Core.Infrastructure.ZipArchiveExtensions.Extract(ZipArchive archive, String directoryName, ITracer tracer,
Boolean doNotPreserveFileTime) in C:\Kudu
Files\Private\src\master\Kudu.Core\Infrastructure\ZipArchiveExtensions.cs:line 155\r\n at
Kudu.Services.Zip.ZipController.d__3.MoveNext() in C:\Kudu
Files\Private\src\master\Kudu.Services\Zip\ZipController.cs:line 67\r\n--- End of stack trace from previous
location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at
System.Threading.Tasks.TaskHelpersExtensions.d__3`1.MoveNext()\r\n--- End of stack trace from previous location where
exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at
System.Web.Http.Controllers.ApiControllerActionInvoker.d__0.MoveNext()\r\n--- End of stack trace from previous
location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at
System.Web.Http.Filters.ActionFilterAttribute.d__5.MoveNext()\r\n--- End of stack trace from previous location where
exception was thrown ---\r\n at System.Web.Http.Filters.ActionFilterAttribute.d__5.MoveNext()\r\n--- End of stack
trace from previous location where exception was thrown ---\r\n at
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at
System.Web.Http.Filters.ActionFilterAttribute.d__0.MoveNext()\r\n--- End of stack trace from previous location where
exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at
System.Web.Http.Filters.ActionFilterAttribute.d__5.MoveNext()\r\n--- End of stack trace from previous location where
exception was thrown ---\r\n at System.Web.Http.Filters.ActionFilterAttribute.d__5.MoveNext()\r\n--- End of stack
trace from previous location where exception was thrown ---\r\n at
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at
System.Web.Http.Filters.ActionFilterAttribute.d__0.MoveNext()\r\n--- End of stack trace from previous location where
exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at
System.Web.Http.Controllers.ActionFilterResult.d__2.MoveNext()\r\n--- End of stack trace from previous location where
exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at
System.Web.Http.Controllers.ExceptionFilterResult.d__0.MoveNext()\r\n--- End of stack trace from previous location
where exception was thrown ---\r\n at System.Web.Http.Controllers.ExceptionFilterResult.d__0.MoveNext()\r\n--- End
of stack trace from previous location where exception was thrown ---\r\n at
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at
System.Web.Http.Dispatcher.HttpControllerDispatcher.d__1.MoveNext()"}
At D:\releases_temp\25f82d5e-c028-4963-bb72-19067cfc9188.ps1:75 char:5
Invoke-RestMethod -Uri $apiUrl -Headers @{Authorization=("Basic { ...
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebExc
eption
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
try with curl to isolate whether this is powershell specific or site issue.
Is there any indication as to why access to the applicationHost.xdt file is being denied? I seem to be in a similar situation
sandboxproc.exe Elapsed = 123.00 ms failed with System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.UnauthorizedAccessException: Access to the path 'C:\home\site\applicationHost.xdt' is denied.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
Hi
If the problem persists and is related to running it on Azure App Service, please open a support incident in Azure: https://learn.microsoft.com/en-us/azure/azure-portal/supportability/how-to-create-azure-support-request
This way we can better track and assist you on this case
Thanks,
Joaquin Vano Azure App Service
scm.mysite.azurewebsites.net/api/zip/site/
PUT with a .zip file won't work for me. Seems to be trying to put to the root D: directory or something. Me and some colleagues are a bit stumped as to why this is not working. Any pointers in the right direction are appreciated! Also if there is a gitter community or something this conversation would be more appropriate in, let me know.Full console output: