sdk-csharp | CSharp SDK for CloudEvents | SDK library
kandi X-RAY | sdk-csharp Summary
kandi X-RAY | sdk-csharp Summary
CSharp SDK for CloudEvents
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of sdk-csharp
sdk-csharp Key Features
sdk-csharp Examples and Code Snippets
Community Discussions
Trending Discussions on sdk-csharp
QUESTION
My UWP app uses app folder (Files.ReadWrite.AppFolder
) for storing app data on OneDrive. I upgraded the app to use Microsoft Graph SDK instead of the old OneDrive SDK (version 1.x).
I didn't get the authentication to work using the old client id registered in https://apps.dev.microsoft.com, so I registered my app in https://aad.portal.azure.com/ and I use MSAL.NET for authentication.
The problem is that the upgraded app creates a new app folder on OneDrive (My App 1) instead of using the old and existing app folder (My App). This would result users loosing their data when they upgrade to this new version.
What should I do to make the upgraded app access the existing app folder and not to create a new one?
...ANSWER
Answered 2020-Sep-19 at 21:13It isn't possible, the app folder is linked to the application's id. If you switch your App Id, you will lose access to the previous folder.
What you really need to do is update your previous app registration and use that to authenticate against Graph.
QUESTION
Describe the bug
DeviceClient SetMethodDefaultHandlerAsync handler is not triggered on internet disconnection instantly. It triggers after 15 to 20 minutes. Below are the logs
IoT Hub connection status Changed Status: Connected Reason: Connection_Ok Time: 3:09:15 PM +02 IoT Hub connection status Changed Status: Disconnected_Retrying Reason: Communication_Error Time: 3:26:29 PM +02
I disconnected the internet at 3:10:00 PM +02 and communication error was thrown after 16 minutes. I have created a sample code which reproduces the issue
Steps to reproduce
...ANSWER
Answered 2020-Aug-31 at 08:08As per the outcome of discussion in github: https://github.com/Azure/azure-iot-sdk-csharp/issues/1409
The SDK is relying on the OS TCP stack to inform that the disconnect has happened, and the OS can take a couple of retries before relaying this information. This might be what is causing the connection status change handler to get invoked with a 15min delay on Linux.
For Mqtt, the client does send a ping request every 75 seconds, but does not seem to be monitoring the ping response being received from the broker.
PS: This is not occurring when using Windows 10 OS
Update
Added a fix for the mqtt layer, where the sdk now monitors for a ping response and disconnects if the delay between sending a ping request and receiving a response is >30secs (this value is currently not configurable).
For the amqp implementation, the amqp library encapsulates this ping request-response logic from us; all that the device sdk does is set the IdleTimeout.
QUESTION
We want to use yandex disk api. Users can upload and delete files using the yandex disk.
I think getting a token from a login page. I tried a lot of sdk but I couldn't find the sample code working properly.
Could you help? i use https://github.com/yandex-disk/yandex-disk-sdk-csharp sdk
but sdk is WPF i use winform
...ANSWER
Answered 2020-Aug-28 at 09:17Implementing the solution to your problem at the bottom of the page on GitHub: https://github.com/raidenyn/yandexdisk.client
QUESTION
I have a MQTT client which publish data (topic) to "AWS IOT" and "Azure IOT HUB".
To see the data into "Azure IOT HUB", I am using "DeviceExplorer": https://github.com/Azure/azure-iot-sdk-csharp/tree/master/tools/DeviceExplorer
I want to know?
...ANSWER
Answered 2019-May-12 at 08:02For Azure portal:
There is no built-in feature to see a telemetry data in the Azure IoT Hub portal. However, the following Azure apps can help you:
In the case of using Visual Studio:
QUESTION
I am using preview version (v1.27.0-preview-003) of Azure IoT SDK. It supports establishing parent child relationship between IoT edge and IoT leaf device. The device object has Scope
property. If Scope
value of edge device is assigned to leaf device, it becomes the child of edge device. Here's the test case for that.
ANSWER
Answered 2019-May-01 at 16:48If you want to do this programmatically, You'll have to use a query on device registry with edge device's deviceScope
.
It is available in the az iot extension directly: https://docs.microsoft.com/en-us/cli/azure/ext/azure-cli-iot-ext/iot/hub/device-identity?view=azure-cli-latest#ext-azure-cli-iot-ext-az-iot-hub-device-identity-list-children
QUESTION
I am using the Azure Device SDK for .NET Core in order to connect my devices to Azure IoT Hub. From time to time the server rejects some messages (like twin updates or telemetry messages) from the devices and responds with status code 400. As a result there are exceptions thrown on client side but due to its asynchronous nature they are swallowed somewhere inside the Azure SDK and never thrown at my code.
How can I actually be notified about these errors so I can handle and display them?
I can also see from the Azure Device SDK code that it uses some kind of logging (EventSource) but this is never enabled in the code:
...ANSWER
Answered 2018-Nov-14 at 18:57You can capture traces: https://github.com/Azure/azure-iot-sdk-csharp/tree/master/tools/CaptureLogs
Our sample demonstrates best practice regarding exception catching, for example: https://github.com/Azure/azure-iot-sdk-csharp/blob/master/iothub/device/samples/DeviceClientMqttSample/Program.cs
QUESTION
Microsoft has its own SDK for interacting with IoT Hub (Microsoft.Azure.Devices) It features a client called ServiceClient that as I understand it is client you are supposed to use when sending messages from your backend to a device through IoT hub.
When initializing the ServiceClient like below the only supported TransportTypes are Amqp and Amqp_websockets_only. My devices only support MQTT. How should I go about that?
public async Task SendMessage()
{
var serviceClient = ServiceClient.CreateFromConnectionString("", TransportType.Amqp);
var commandMessage = new Message(Encoding.ASCII.GetBytes("Cloud to device message."));
await serviceClient.SendAsync("myFirstDevice", commandMessage);
}
According to the c2d guidelines "all protocols" are supported.
I have read through this documentation, but it only documents device to cloud, not cloud to device.
Looking at the SDK documentation it only lists AMQP for key features under device-to-cloud
...ANSWER
Answered 2018-Nov-14 at 12:31For device-to-cloud messaging, the device can use the MQTT, MQTT-WS, AMQP, AMQP-WS, or HTTP protocols. See the IoT Hub device SDK key features. A device communicates with IoT Hub for both d2c and c2d using the Microsoft Azure IoT device SDK for .NET. Note that there are also device SDKs available for Java, Node, Python and C.
If you have a back-end application that needs to send a c2d message to a device, then that back-end application should use one of the Azure IoT service SDKs such as Microsoft Azure IoT service SDK for C# to connect to IoT Hub and send the c2d message. The back-end application must use AMQP or AMQP-WS.
The protocol used by the device to connect to IoT Hub is independent of the protocol used by the back-end application to connect to IoT Hub. For example, a back-end application could connect to IoT Hub using AMQP to send a c2d message to a device that's connected to the hub using MQTT.
QUESTION
I have a Web API that's hosted in Azure, and I have continuous deployment set up from a GitHub repository.
There's some functionality I need to implement that relies on a third-party DLL, so I added it as a reference to my project. Everything works fine locally, but when I commit my changes with the new DLL, the deployment fails in Azure with this message:
error CS0246: The type or namespace name 'MyReference' could not be found (are you missing a using directive or an assembly reference?)
If I open my .csproj file, this is how the reference is added, so maybe there's an issue there:
...ANSWER
Answered 2018-Sep-21 at 18:09The problem is, that you actually referenced this Assembly (DLL) by a relative path depending on your local environment (the User-folder part is an hint). But if you use continous deployment tirggered by a git repo all the stuff must be referenceable from the git repo or the build process. In the build environment the releative path is not available and this is why it can not be referenced.
Solution:
1. Reference your assembly as a nuget package and call a nuget restore
in your continous integeration build process
- or -
2. Create a kind of lib
folder in your project and place your third party assembly there. Than commit this library as part of your project (reference it there relative to your project)
Hope this helps...
QUESTION
I submitted UpdateReportedPropertiesAsync doesn't update the Device Twin timestamps in azure-iot-sdk-csharp's github, but I wonder if maybe I just don't know something and I decided to ask here as well.
Is there documentation explaining when IoT Hub Device Twin's statusUpdateTime
, connectionState
, and lastActivityTime
are updated?
My problem:
I have a device that periodically updates reported properties using DeviceClient
's UpdateReportedPropertiesAsync
but the timestamps stay empty:
ANSWER
Answered 2018-Sep-06 at 02:27Is there documentation explaining when IoT Hub Device Twin's statusUpdateTime, connectionState, and lastActivityTime are updated?
You can reference "Device identity properties" part.
I have a device that periodically updates reported properties using DeviceClient's UpdateReportedPropertiesAsync but the timestamps stay empty:
It seems an issue of old SDK and it has already been fixed. I use Microsoft.Azure.Devices.Client 1.18.0, it works for me. You can have a try.
QUESTION
I am trying to generate a valid SAS token (shared access signatures) to connect to the Azure IoT Hub, but I keep getting the error Connection refused: Not authorized
when using the token.
I know the way I am connecting is working because when using a SAS token generated with the Microsoft Device Explorer (https://github.com/Azure/azure-iot-sdk-csharp/tree/master/tools/DeviceExplorer) it works as expected.
To write the Javascript code I started from this documentation https://docs.microsoft.com/en-us/azure/storage/common/storage-dotnet-shared-access-signature-part-1 comparing with some working implementations:
- in Python: https://github.com/Azure/azure-sdk-for-python/blob/master/azure-servicebus/azure/servicebus/servicebusservice.py
- in Go/Golang: https://github.com/openenergi/go-event-hub/blob/master/msauth/sasl.go
What am I doing wrong in the following Javascript implementation? I think it may be related to the SHA256 signature combined with URL escaping the string but I am not sure how to test/verify this.
...ANSWER
Answered 2018-Aug-08 at 03:43Here is an example of generating SAS token via node.js.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install sdk-csharp
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page