Com Port Mapping - Azure IOT Edge - Windows IOT 2019 - azure-iot-edge

I have an edge device (Welotec MK3) with on board Serial ports that I would like to access Modbus RTU devices with. Issue resides in the proper configuration of the Container Create Options - thus in mapping the physical to the containers com port.
{
"HostConfig": {
"Devices": [
{
"PathOnHost": "COM2",
"PathInContainer": "COM2",
"CgroupPermissions": "rwm"
}
]
}
Physical com port is identified in Window 2019 IOT as COM2, but IOT Edge s throwing an error indicating improper mapping.
Hoping someone has come across this and can provide some guidance.
Thanks

The deployment syntax for device access uses PathInContainer:"" and PathOnHost="class/<device interface guid>". The device interface guid for serial is 86E0D1E0-8089-11D0-9CE4-08003E301F73. note also that this only works with --isolation process. see msdn for more info.
The best way to refer to the device in your container app depends on the language you're writing in and container OS you're using.

Related

Connect Mininet OVS to physical switch

I have two VirtualBox VMs running in my PC, one running a ONOS controller and the other running a Mininet topology with two OVS. Both OVS and physical switch appear in the remote ONOS controller, but i am trying to connect one of the OVS in mininet to a physical ALU-OS (Alcatel OS-6250) switch with no success. I'm just trying to do a simple example to see if it works.
Any idea how?
Please I really could use the help :)
Thanks in advance,
Mariana
You might find this post and answer from Elisa Rojas useful
Summary
Use the statement:
_intf = Intf( intfName, node=switch ), being intfName the host interface (possibly towards the switch. Might need forwarding enabled in Linux) and switch, the mininet switch you want to connect it too.

Queries execute faster when hosted on laptop than on server

I am experiencing a strange issue when publishing an ASP MVC application to Windows Server 2012.
The app is fairly simple, and on most of the pages visited it will query an Access database which is hosted on the server.
I noticed that the queries are quite slow (often taking between 7-10 seconds to complete), as shown when running the app with MiniProfiler.
As a simple test, I decided to host the app on my Windows 10 laptop to see if there was a difference, and it is much faster (Most queries are under 200ms).
This is what I tried so far:
Match advanced Application Pool settings
Match Firewall settings
Enabled link local multicast name resolution (LLMNR)
Confirmed that ODBC tracing is disabled (32 and 64)
Moved the Access Backoffice.mdb file to the server's C drive (same as on the laptop)
Made sure web.config match (apart from connectionString Data Source)
Added C:\inetpub\wwwroot\website and C:\Test\Database to antivirus scan exclusions
Increased the MaxBufferSize key value from 0 in Access Connectivity Engine in the registry
Does anyone know of a way that I can try debugging this issue, or any possible solutions?
notes
Both my laptop and the server are on the same network while testing this, and I am accessing the app from an ipad.
I am also experiencing the same slowness when using the application from a browser on the server itself (url = 10.0.0.1 or localhost)
When I execute the exact same query code from a console app on the server, it runs a lot faster (on par with the laptop). I am only experiencing this issue via the asp app.
Laptop Details:
Processor : Intel Core i7-6700HQ CPU # 2.60GHz
RAM : 16.0 GB
OS : Windows 10 x64
Server Details
Processor : Intel Xeon CPU E5-2603 v4 # 1.70GHz (2 processors)
RAM : 32.0 GB
OS : Windows Server 2012 x64
Connection String
I have tried the following:
Provider=Microsoft.ACE.OLEDB.12.0;Data Source=W:\My Backoffice.mdb
Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Test\My Backoffice.mdb
Provider=Microsoft.ACE.OLEDB.12.0;Data Source=\\ServerName\W\My Backoffice.mdb
Provider=Microsoft.ACE.OLEDB.12.0;Data Source=\\ServerName\C\Test\My Backoffice.mdb
With both 16.0 and 12.0 as the ACE.OLEDB version, where W is a Local server drive which is used as a network share acrcoss the domain. All of these gave the same result.

Use SO_REUSEPORT with Phoenix

I am interested in a zero-downtime deployment system that does not use Elixir/Erlang hot upgrades (due to the complexity of data migrations while the code is running).
I have heard that I may be able to use the SO_REUSEPORT option when binding the server to the adapter, such that I can run two instances of the same application bound to the the same address and port. My intent is to deploy version 2 on the same server as a running version 1, start version 2, and then gracefully stop version 1, which should allow incoming connections to naturally begin connecting exclusively to version 2.
Regardless of whether this works exactly as I plan - my intent is to test this configuration knowing that it behaves differently on different OSes - I would like to know the specific steps necessary to configure Phoenix to do this, as this seems to be a lower-level configuration within :gen_tcp.
If, alternatively, there is a way to configure the OS or Erlang VM to make all connections with this option enabled by default, that would be even better.
You should specify raw SO_REUSEPORT flag for a socket in the format {:raw, protocol, option_num, value_bin}
gen_tcp option/raw and pass it to the underlying transport.
Please note, that flags are different for mac/linux. In your config.exs:
so_reuseport =
case :os.type() do
{:unix, :linux} -> {:raw, 1, 15, <<1::32-native>>}
{:unix, :darwin} -> {:raw, 0xffff, 0x0200, <<1::32-native>>}
end
config :yourapp, YourApp.Endpoint,
http: [port: {:system, "PORT"}, transport_options: [socket_opts: [so_reuseport]]]
Tested on Phoenix 1.4.9, but I guess older versions should be ok too.
Here are the corresponding docs for used options.
http Phoenix.Endpoint — Phoenix
v1.4.9
transport_options Plug.Cowboy — PlugCowboy
v2.1.0

Can I edit an iPad's host file?

I doubt this is possible without extensive jail-breaking, but is it at all possible to edit the iPad's (or any iOS device's) hosts file?
The previous answer is correct, but if the effect you are looking for is to redirect HTTP traffic for a domain to another IP there is a way.
Since it technically is not answering your question, I have asked and answered the question here:
How can I redirect HTTP requests made from an iPad?
No, you can't change iPad's host file(without jailbreak), but can workaround.
Here is my scenario:
Mac OS X, with IP 192.168.2.1, running a web app
iPad, the device you would like to test the web app
Charles (for Mac), enables HTTP proxy for your iPad
I am going to test the web app running in my Mac via iPad, but I can't access directly to it.
The solution works for me:
Firstly, make sure that your server and iPad are in the same local network.
Then, set up Charles proxy, in the menu "Proxy > Proxy Settings...", fill in Port(mostly 8888) and toggle Enable transparent HTTP proxying.
Setup proxy setting in iPad.
Now you can visit your web app in iPad.
Of course you can use other proxy tools like Squid or Varnish in Linux, or fiddler in Wondows.
No. Apps can only modify files within the documents directory, within their own sandbox. This is for security, and ease of installing/uninstalling. So you could only do this on a jailbroken device.
The easiest way to do this is to run an iPad simulator using XCode and then add an entry in the hosts file (/etc/hosts) on the host system to point to your test site.
I needed the same functionality, and doing jailbreak is no-no. One solution is to host yourself DNS server (MaraDNS), go to your wifi settings in ipad/phone, and add your custom DNS server there.
The whole process took me only 10 minutes, and it works!
1) Download MaraDNS
2) Run mkSecretTxt.exe as administrator
3) Modify mararc file, mine is:
ipv4_bind_addresses = "put your public IP Here"
timestamp_type = 2
random_seed_file = "secret.txt"
csv2 = {}
csv2["Simple.Example.com."] = "example.configuration"
Add file called "example.configuration" into the same folder where run_maradns.bat is.
4) Edit your example.configuration file:
Simple.Example.com. 10.10.13.13 ~
5) Disable all Firewalls (convenience)
6) Run file "run_maradns.bat"
7) There should be no errors.
8) Add your DNS server to list, as shown here: http://www.iphonehacks.com/2014/08/change-dns-iphone-ipad.html
9) Works!
Yes, you can edit the iPad hosts file, but you need to be jailbroken. Once you've done that, download Cydia (app market), and get iFile. The hosts file is located within "/etc/hosts".
I would imagine you could do it by setting up a transparent proxy, using something like charles and re-direct traffic that way
Workarond I use for development purposes:
Create your own proxy server (One option would be: Squid on Linux).
Set your hosts file with your domains.
Set the proxy server on the IPAD/IPHONE and you can use with your hosts.
I know it's been a while this has been posted, but with iOS 7.1, a few things have changed.
So far, if you are developing an App, you MUST have a valid SSL certificate recognized by Apple, otherwise you will get an error message on you iDevice. No more self-signed certificates. See here a list:
http://support.apple.com/kb/ht5012
Additionally, if you are here, it means that you are trying to make you iDevice resolve a name (to your https server), on a test or development environment.
Instead of using squid, which is a great application, you could simply run a very basic DNS server like dnsmasq. It will use your hosts file as a first line of name resolution, so, you can basically fool your iDevice there, saying that www.blah.com is 192.168.10.10.
The configuration file is as simple as 3 to 4 lines, and you can even configure its internal DHCP server if you want.
Here is mine:
listen-address=192.168.10.35
domain-needed
bogus-priv
no-dhcp-interface=eth0
local=/localnet/
Of course you have to configure networking on your iDevice to use that DNS (192.168.10.35 in my case), or just start using DHCP from that server anyway, after properly configured.
Additionally, if dnsmasq cannot resolve the name internally, it uses your regular DNS server (like 8.8.8.8) to resolve it for you. VERY simple, elegant, and solved my problems with iDevice App installation in-house.
By the way, solves many name resolution problems with regular macs (OS X) as well.
Now, my rant: bloody Apple. Making a device safe should not include castrating the operating system or the developers.
If you have the freedom to choose the hostname, then you can just add your host to a dynanmic DNS service, like dyndns.org. Then you can rely on the iPad's normal resolution mechanisms to resolve the address.
You can also make use of a proxy server on your iPhone or iPade via mobile internet (3G) by using a iPhone Mobile proxy generator:
http://iphonesettings.net/mobileproxygenerator.php
Just enter the apn of your carrier (with apn username/password if needed) and the proxy server you want to go through and tap Generate
Problem Restated: Bypassing DNS Resolution
The problem the OP is trying to solve is NOT hacking hosts files on iPads per se, but rather bypassing DNS Resolution of a specific published DNS record by creating a static, local IP:name mapping on their device.
Solution:
A better- and more scalable- way is to create the static IP:Name mapping that you'd create in the hosts file on the device and instead create it on the router and then point your DHCP addressed clients to that router as the primary source of DNS resolution as I document (with annotated screen shots) HERE.
Conclusion:
When testing a new site you need to check the display of it on multiple devices to ensure there's no funky display or usability issues. Bypassing DNS checking using static local IP:Name mappings would require each developer to hack the hosts files for each of their devices and then remember to unwind the changes in all their devices after testing.
And were it even possible to hack an iPad's hosts file as the OP enquired about, in many organizations the Developers IT assets will be locked-down and they won't they have administrative permissions to do such tinkering.
Better to make the static mapping to bypass the published DNS record in the router and then you can delete it in one place after testing is completed.
You need access to /private/etc/ so, no. you cant.
Best Answer: Simply add http or https in your browser, the IP address, colon and port number. Example: https://123.23.145.67:80

azure generating false wsdl address

I start my azure application, I browse to the svc file http://127.0.0.1:82/transaction.svc,
and I get the usual:
You have created a service.
To test this service, you will need to
create a client and use it to call the
service. You can do this using the
svcutil.exe tool from the command line
with the following syntax:
svcutil.exe
http://rzv-pc:5100/Transaction.svc?wsdl
If i go to http://rzv-pc:5100/Transaction.svc?wsdl the age is blank.
If I go to http://127.0.0.1:82/transaction.svc?wsdl, I get the wsdl but there are still references like
<xsd:import schemaLocation="http://rzv-pc:5100/Transaction.svc?xsd=xsd1"
I can't use svcutil on any of this links. What is the problem? I use Azure SDK 1.1.
See http://code.msdn.com/wcfazure (particularly the "known issues" page). The issue stems from the fact that there are two ports involved. One is the external port (that the load balancer listens on), which is port 82 in your case. The other is the internal port, that your code listens to on its VM in the cloud, which is port 5100 in your case.
Note that in SDK 1.3, you can specify the localPort attribute on your endpoints, which lets you choose what that internal port is. You can make it the same as the external port and thus avoid all strangeness.

Resources