Im using an example from this link :
https://learn.microsoft.com/he-il/azure/storage/blobs/storage-quickstart-blobs-dotnet?toc=%2Fen-us%2Fdotnet%2Fazure%2FTOC.json&bc=%2Fen-us%2Fdotnet%2Fazure_breadcrumb%2Ftoc.json&view=azure-dotnet&tabs=windows
it works fine on local device , and i can upload a file to azure. but when i run the app on the raspberry pi , i get an error while trying to upload the file :
ex {Microsoft.WindowsAzure.Storage.StorageException: Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.
at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.d__c`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
at App10.MainPage.d__31.MoveNext()
Request Information
RequestID:df2e03db-101e-0128-4a45-c640d2000000
RequestDate:Sat, 16 Feb 2019 12:06:26 GMT
StatusMessage:Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.
ErrorCode:AuthenticationFailed
ErrorMessage:Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.
RequestId:df2e03db-101e-0128-4a45-c640d2000000
Time:2019-02-16T22:14:38.5545020Z
} Microsoft.WindowsAzure.Storage.StorageException
any ideas?
I think that the problem is the authentication, in the original article Microsoft tell you to call setx storageconnectionstring "<yourconnectionstring>", have you made it on raspberry?
The sample works for me with following steps.
Replace the variable storageConnectionString with the connection string of my storage.
Run command dotnet publish -r win10-arm to publish the app for windows iot core.
Copy the folder storage-blobs-dotnet-quickstart\bin\Debug\netcoreapp2.0\win10-arm\publish to the device.
Run the storage-blobs-dotnet-quickstart.exe via powershell connected with device.
It would works fine. Please try again. If the error appears again, feel free let me know.
I have solved my problem.
both of you are right. because the time was not set right azure reject the request. after setting the time the RP have managed to send the data to blob. tnx !
Related
I am working on a .NET API that runs inside of a docker container. At some point it makes a call to a Python Flask API that is also running in a container.
var response = await httpClient.GetAsync("http://service-name:8000/actual/url")
which then produces the following error:
System.Net.Http.HttpRequestException: Resource temporarily unavailable
---> System.Net.Sockets.SocketException (11): Resource temporarily unavailable
at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken
cancellationToken)
Has anyone had experience with this before and potentially knows a solution? I cant find much on the web about it at all. I have some seen some mentions of the issue potentially being related to the Flask API not using async methods but that doesnt make sense to me.
The Flask API produces the appropriate responses when accessed through a web browser or Postman using localhost:8000/actual/url and the container logs these responses. I have tried using the localhost URL in the .NET API but that does not work either.
If anymore information is needed please leave a comment and I will do my best to update the post quickly.
-- Christie
TLDR
A reason for the "Resource temporarily unavailable" error is when during name resolution the DNS Server responds with RCODE 2 (Server failure).
Long answer
I noticed the same behavior in a dotnet application running in a dotnet runtime alpine docker container. Here are the results of my investigation:
The error message "Resource temporarily unavailable" corresponds to the EAGAIN error code which gets returned by various functions from the C standard library. At first I suspected the connect() function because the C# stack trace indicates the error happening during the ConnectAsync() call of the c# socket. And indeed the EAGAIN error code appears in the man page of connect() with this description: "No more free local ports or insufficient entries in the routing cache".
I simulated a system with depleted local ports and noticed that a different exception gets thrown in that case, which rules out local port availability as a root cause for the original exception. Regarding the other mentioned cause in the man page it turns out that the routing cache was removed from Linux in 2012. commit
I started to look around for EAGAIN in the source of the musl C lib which is used in the dotnet runtime alpine docker container. After a while I finally noticed the gethostbyname2_r function which is used for resolving a domain name to an ip address via DNS. During System.Net.Sockets.Socket.ConnectAsync() the hostname is still a string and the name resolving happens in native code using the gethostbyname2_r function (or one of its variations).
The final question is: When does gethostbyname2_r return the EAGAIN error code? It's when the RCODE field in the header of the DNS Response has the value 2, which stands for "Server failure". source line 166
To verify this result I ran a simple mock DNS server which always returns the RCODE 2 in the DNS response. The resulting c# exception along with the stack trace matched the original exception exactly.
I have a Stateless Service Fabric project (.NET Core) that I need to kick off a Docker job from. I'm using Docker.DotNet and the following code works well in a small Console App, however will not work in Service Fabric:
var dockerClient = new DockerClientConfiguration(new Uri("npipe://./pipe/docker_engine")).CreateClient();
// error occurs on next line (in Service Fabric)...
dockerClient.Images
.CreateImageAsync(new ImagesCreateParameters
{
FromImage = "jbarlow83/ocrmypdf",
Tag = "latest"
},
new AuthConfig(),
new Progress<JSONMessage>());
I see this error in Service Fabric Explorer if I try to run it from the Stateless SF project:
System.UnauthorizedAccessException: Access to the path is denied.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.Pipes.NamedPipeClientStream.ConnectInternal(Int32 timeout, CancellationToken cancellationToken, Int32 startTime)
at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Docker.DotNet.DockerClient.<>c__DisplayClass6_0.<<-ctor>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Net.Http.Client.ManagedHandler.d__33.MoveNext()
I'm not sure if this is actually a permission issue, or if it's related to how Service Fabric network isolation works.
I'm trying this on my local development instance, and this will eventually (hopefully) go to an on-premise setup.
Is there a way to access named pipes on the node that is hosting a SF application? Or perhaps another suggested way to run Docker through a .NET Core SF application?
Just came across this when I ran into this issue today, and ended up stumbling onto a different solution if you don't want to switch away from the Named Pipe connection. If you set up your Service Fabric service to run as a LocalSystem Account instead of the default account, it should work as well.
You can follow the instructions here to change the Account your Stateless Service runs under in the Manifest
This works because according to this article on Named Pipes, only certain types of accounts get access to the Named Pipe, one of which is LocalSystem.
I was able to get this working by changing my DockerClientConfiguration line to no longer use named pipes, and instead use http://localhost:2375:
var dockerClient = new DockerClientConfiguration(new Uri("http://localhost:2375")).CreateClient();
And then enabled Expose daemon on tcp://localhost:2375 without TLS in the Docker CE General Settings:
I am trying to add some telegram functions to my winForm app. I am using TLSharp library for that. However there is no proper manual on how to logout from the account. Everything I found on forums led to this:
var LogOut = new TLRequestLogOut();
await MainWindow.client.SendRequestAsync<Boolean>(LogOut);
That does log out but, 1st - It gives an Exception error:
System.InvalidOperationException: Couldn't read the packet length at TLSharp.Core.Network.TcpTransport.<Receieve>d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
2nd - The "IsUserAuthorized" still return true after logout request.
3rd - session file, even being deleted with
File.Delete(sessionName);
restores itself
I'm rather new to everything so I'm hoping this is an easy fix!
I've written an API that uses basic authentication. It works wonderfully on local host, when I try to make a GET call from my browser it will popup asking for my username/password. I enter it and it does what is should.
However, after I publish it to our server it stops working. If I do the same thing it just returns an error rather than a challenge.
Here is what it returns on the server side.
An error has occurred.
No OWIN authentication manager is associated with
the request.
System.InvalidOperationException
at
System.Web.Http.Owin.PassiveAuthenticationMessageHandler.SuppressDefaultAuthenticationChallenges(HttpRequestMessage
request) at
System.Web.Http.Owin.PassiveAuthenticationMessageHandler.d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown --- at
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
task) at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() at
System.Web.Http.HttpServer.d__0.MoveNext()
I'm not sure that this is a good solution but I managed to solve the problem.
After reading this https://katanaproject.codeplex.com/discussions/531740
I added <modules runAllManagedModulesForAllRequests="true"> In the web config.
Which gave me the username/password prompt that I needed.
After fixing that I realized that having Basic Authentication turned on in the IIS settings was causing it to loop the login prompt. Once I turned it off there I had no more problems.
Hope this helps if anyone else gets in this situation.
I have a Windows 8.1 app on the Store, but when I try to use the next piece of code for a new feature I want to add to my app
var listingInfo = await CurrentApp.LoadListingInformationAsync();
I receive an error which I don't exactly know what it means. I did catch the error though and I displayed it on a MessageDialog and then I took a print screen. This is the error:
We could not receive your donation due to an unexpected error:
System.Exception: Exception from HRESULT: 0x801900CC
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at ArchMedia_Player.Services.Donations.<ListingInformationAsync> d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at ArchMedia_Player.Services.Donations.<Donate>d__a.MoveNext()
Does anybody know what that means and how can I solve it ?
I also mention that this works perfectly ok: (using the CurrentApp Simulator)
var listingInfo = await CurrentAppSimulator.LoadListingInformationAsync();
System.Exception: Exception from HRESULT: 0x801900CC
That's an expected exception while you are developing your app. The error code is BG_E_HTTP_ERROR_204, 0xCC encodes the HTTP response error code. 0xCC == 204, HTTP error 204 means "No content". Or in other words, the Store server is not aware of your app having any in-app purchases.
This is a chicken-and-egg problem, the server doesn't know about your in-app purchases until after you submitted your app and got it approved. You must test your app with CurrentAppSimuator to debug and test your in-app purchases. The basic how-to guide is here. One important step you must not forget is to substitute CurrentAppSimulator with CurrentApp just before you submit your app for verification.
That your app is already in the Store does not factor in when you added in-app purchases to your new version. The crucial required step is to make the Store server aware of your purchase options. As described by the linked MSDN article, you do this when you submit the app. They will not be effective until your submission is approved.
So, do not panic, you can test your code with the simulator. When you've verified that you got that working, there's little reason to fear this being a problem after you submitted the app, as long as you follow the steps in the MSDN article.
I had same exception. I updated package certificate File (StoreKey.pfx), by creating package with sign in to the windows store. And it fix problem for me.