I am trying to create a IoT DPS device with a symmetric key, For that to work, I need a ProvisioningTransportHandlerMqtt.
I have tried the console application fromlearn: https://learn.microsoft.com/en-us/azure/iot-dps/how-to-legacy-device-symm-key?tabs=windows&pivots=programming-language-csharp and I can provision devices with it.
I have tried making an interactive .Net notebook, and I can also provision devices from that:
The issue is only in my own cs file. When I try to run a similar line in a cs file the object is different:
The samplecode from Microsoft produces a valid transportHandeler:
I have no clue how to create a proper transportHandler. How do I get a proper ProvisioningTransportHandlerMqtt()?
Turned out including the DotNetty dlls in my app solved the issue.
Related
Our company uses Cisco telephony. And we have a little program on user-s PC wrote by our partner. This program tracks incoming calls and for the call rises record in our CRM-System. This program uses tapi3 (it is COM-object from deep inside of windows). Unfortunately, it doesn't work on PC with Windows 10.
Search a lot for causes of this problem didn't give me even some a bit useful answers. And indeed, I am coming to the opinion, that this library by itself have some problems with working with it on Windows 10.
Well I tried a lot of things, before wrote this question. Tried to use other versions (later versions) of tapi driver for cisco (CiscoTSP). Tried to use other instances of tapi3. Tried to make this program work on other machines with win10. And now I have no result.
This small example demos the problem.
using System;
using System.Collections.Generic;
using TAPI3Lib;
namespace TestTAPI
{
class Program
{
static void Main(string[] args)
{
var tapi = new TAPIClass();
tapi.Initialize();
List<String> names = new List<string>();
foreach (dynamic address in (tapi.Addresses as ITCollection))
{
names.Add(address.AddressName);
}
}
}
}
In result of execution I have empty List of Addresses, but it shouldn't be empty.
At least I should be see standard tapi Addresses, but I didn't. Moreover I see in "Control Panel" -> "Telephone and modem", that I have more Addresses then only standards.
Really don't know what is going wrong. Maybe I miss some details?
Or may be I can change using tapi3 to something else to make that work.
Assuming it works on an Win8 or Win8.1 (you did not specify). Have you checked your drivers config? If you save a config setting and then open the config page in "phone and modem" has it reset to default?
TAPI drivers default registry key for storing their config is here:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Telephony
Some (not all) flavors/edition/versions of Windows 10 have removed the access rights to the registry key from the built-in system account that runs the telephony service.
I don't know about Cisco specifically, but we have encountered several TAPI drivers from various manufactures that "save" their settings without giving an error, but in fact have not changed because of this issue.
Open your services.msc and check the Telephony (TapiSrv) service account, then check if it has access to the registry key.
I’m trying to log some stuff to ETW on my UWP application deployed to RPI2 (Windows IOT v.10.0.15063.0). On device portal I can see new logs but message is empty (payload gives me: “stringmessage:,”)
var _loggingChannel = new LoggingChannel("HA4IoT", null, new Guid("4bd2826e-54a1-4ba9-bf63-92b73ea1ac4a"));
_loggingChannel.LogMessage("Test", LoggingLevel.Information);
I’m trying to use LogEvent instead but any string field behaves like that - values logged are empty and saved CSV also have no data about logged stuff.
Sorry you hit this - there's a known regression in the ETW parsing logic in the Creator's Update for Device Portal that we're working to fix. Right now we don't have a workaround except to write a WPR profile and collect an ETL, and use the ETL to collect your logs.
You can track our fix here: https://wpdev.uservoice.com/forums/110705-universal-windows-platform/suggestions/18591439-loggingchannel-not-showing-string-message-content
I'll update it when the code is fixed in an Insiders flight, and then once we know if the fix can be backported.
Update: This is fixed in the Fall Creators Update, and has been in flights for a couple months. Expect to see it in the next update of Windows across platforms.
On my Raspberry Pi2 it works. I copied your code and executed it.
My Windows IoT Core 10 version is: 10.0.14393.67
The result looks like this:
I set the target version of the IoT background application to the following:
The CSV export also looks fine on my machine:
Timestamp,Provider,ID
04/27/2017-21:23:36.8150656,HA4IoT,0,Keyword:1,Level:4,ProviderName:HA4IoT,StringMessage:Test,TaskName:LogMsgInformation,WebbCompletePayload:stringmessage:test,
Best regards,
Christian
var rawData = Convert.FromBase64String(_signingKey);
var cng = CngKey.Import(rawData, CngKeyBlobFormat.Pkcs8PrivateBlob);
I use this code to extract key, from embedded base64 string.
It works fine when I test it locally but when I publish on azure I get following exception:
WindowsCryptographicException: The system cannot find the file specified
(once again I'm not reading from any file)
I need this to communicate with apple apns for push notifications, is there any workaround?
And this happens only on free service plan, if I switch to basic plan it's working.
I ran into the same error after publishing an existing application to Azure. In my case the problem was solved after I set WEBSITE_LOAD_USER_PROFILE = 1 in App Services / App Name / Application Settings.
Setting WEBSITE_LOAD_USER_PROFILE to equal 1 in the Azure App Service configuration definitely got my remote iOS notifications working. Using dotAPNS for C# .NET I also needed to omit apns.UseSandbox().
It seems that it causes by there is no certificate attached in your Azure Mobile App. If it is that case, we need to upload the "Development" or "Distribution" SSL certificate to the WebApp. More info about how to send push notifications to iOS App, please refer to the azure document.
I've had a similar error trying to construct a X509Certificate2 from a byte array - worked fine locally but once I deploy to Azure Web App, I got the same and VERY misleading file not found exception.
The real issue turned out to be that there was no user store associated with the web service account. You can also get a similar error if there are permission-related errors with accessing the certificate store on Windows.
In any case - In my scenario I fixed the problem by using MachineKeySet:
new X509Certificate2(certRawBytes, default(string), X509KeyStorageFlags.MachineKeySet);
So, in your scenario, try something like:
var keyParams = new CngKeyCreationParameters
{
KeyCreationOptions = CngKeyCreationOptions.MachineKey,
};
CngKey.Create(CngAlgorithm.Rsa, keyName, keyParams);
Note: You may have to set a few parameters to get the above working. The Import method doesn't seem to support MachineKey - but you should be able to achieve similar outcome by using the Create method.
To add to #strohmsn's answer, you can also set the App Service settings with this value directly within Visual Studio on the Publish page for web apps: Right click on web app and select Publish, then select App Service Settings, and you can add setting properties there: WEBSITE_LOAD_USER_PROFILE = 1 in this case. See screenshot:
For making it works, I needed TWO things in AzureWebApp..
So my code is :
//I load the PrivateKey here
ReadedByte = System.IO.File.ReadAllBytes(strPathPrivateKey);
//create the RSA thing
RSA rsa = System.Security.Cryptography.RSA.Create();
//import the key. It crashed HERE with the 'System cannot find file specified'
rsa.ImportPkcs8PrivateKey(source: ReadedByte,bytesRead: out int _);
It works perfectly locally. But, to make it WORK on Azure Web App, I had to have those TWO requirements :
1 - the WEBSITE_LOAD_USER_PROFILE = 1 spoken in the discussion above and below
2 - The App Service Plan must include "Custom domains / SSL" !
...so No 'F1 Share Infrastructure' nor 'D1 Share Infrastructure'. The lowest Service plan that worked for me was 'B1 - 100 Total Acu'.
Maybe I have something wrong somewhere else in my code, or my 'RSA' choice is bad..anyway...
It now works!
I am currently uploading files to a unix server using SFTP using Renci SSH.NET, and it works fine. However, I now would like to upload files to a "Symlink container", and then create a symlink in another directory pointing to these files. Is that possible? I haven't found a class to manage symlinks, so how can this be achieved?
Use the SftpClient.SymbolicLink method.
public void SymbolicLink(string path, string linkPath)
Note that the meaning of the paths is a mess. The most common SFTP server, the OpenSSH, is buggy and uses the paths in a wrong order. Many other SFTP servers follow the bug for a compatibility. But not all. So you have to test which order is used by your servers.
See
https://bugzilla.mindrot.org/show_bug.cgi?id=861
http://bugs.proftpd.org/show_bug.cgi?id=4080
I have worked with SSH.net and I don't have found something about symlinks. However I found that SSH.net supports custom commands therefor you can write the Linux command (I think that it's ln) to create the symblink.
In this url you can get an example about how to use a custom command with SSH How to run several commands with SSH.Net?
Maybe if you need to create a lot symlinks, you can create a class or you can download the source code and add a new method.
I hope this can help you.
I have been making an UWP app with the using a MapControl but when I run the app I get an error in the bottom corner saying "Warning: MapServiceToken not specified". The XAML I am using is as follows:
<Maps:MapControl x:Name="MapControl1" Loaded="mapLoaded" ZoomLevelChanged="mapZoomChanged" MapServiceToken="AqK9nK0h_LngGSC8pHPzBJvl62yf617zRytgimB3fyYqdJPljcB-EGm3llmUUrlI"/>
As you can see I have specified the MapServiceToken and I have also tried specifying it using C# with no luck.
MapService.ServiceToken = "AqK9nK0h_LngGSC8pHPzBJvl62yf617zRytgimB3fyYqdJPljcB-EGm3llmUU...";
MapControl1.MapServiceToken = "AqK9nK0h_LngGSC8pHPzBJvl62yf617zRytgimB3fyYqdJPljcB-EGm3llmU...";
I have used www.bingmapsportal.com to get my token but I have also tried using the Application ID and Authentication Token from the Windows Dev Center. Any Ideas?
NOTE: For those who may be using older keys from Windows 8 platform
There seems to be an issue updating old keys to the Universal Windows Platform type. I had a key that was created in 2014, but even after I updated the key to Universal Windows it still would not authorize when I placed the key in the MapServiceToken value of the XAML. (it seems as though the value of the key itself never changes when you change the type on the key, even though it should update with a new value)
In order to solve this you have to create a brand new application key and use that value instead, and then the Warning message will go away.
I got the same issue but here is my solution.
First navigate to https://www.bingmapsportal.com/Application. Find the link to create a new key.
On the form, fill in the Application type field. The available options are:
Dev/Test
Mobile Application
Website
Windows Application
Even though you are developing a Xamarin.Forms project (that is intuitively a kind of mobile app), you must choose Windows Application rather than Mobile Application. Why? The reason might be "UWP is an Windows Application". Period.
Failure doing so will trigger the warning.
Sign into the Microsoft Dev account and navigate to this URI
https://www.bingmapsportal.com/Application#
Here the Key can be obtained for Universal.
It can be set in the XAML MapServiceToken, works fine!
Also, you can sign in directly on Bing Maps to generate a key.
https://www.bingmapsportal.com/
My Account -> My keys
For UWP, this key is quite long.
FYI, when I added the key on XAML for MapControl using MapServiceToken property, the app crashed my computer. Then when I restarted it, the App run well. Oh dear me...
Read Microsoft documentation
https://learn.microsoft.com/en-us/windows/uwp/maps-and-location/authentication-key
Generate new key and add it in MapControl MapServiceToken. Its work for me.