WinRT application accessing external LAN via Cisco VPN - c#

I'm developing a WinRT application. Said application will use a corporate LAN in the end to connect to available services. I suspect things will work smoothly then.
However, I'm having a bit of an issue during development.
Since I'm not on-site where the services are being developed (and where the test services have been deployed) I've been given VPN access using the Cisco Systems VPN client.
Note, that I can access the services using a browser, so I know the connection is working fine.
My issue is that the WindowsRT application doesn't seem to play nice with the VPN connection, and I get the following error when attempting to access the services:
Could not connect to net.tcp://[ServiceIp]/[ServicePath].
The connection attempt lasted for a time span of 00:00:00.0463816.
TCP error code 10013: An attempt was made to access a socket in a way
forbidden by its access permissions [ServiceIp].
AFAIK the above error is thrown when a WinRT application doesn't have the required permission (for example, to access LAN or WAN). However, out of desperation, I've tried ticking ALL the requested capabilities boxes in the package configuration, but I'd still get the same error.
Furthermore we've been given a local version of the services, and in our own LAN the application CAN connect.
Note: I still want to connect to the development machine over the VPN, because that's where all the test data is (our own machine has mock data - it was initially useful, but at this stage we need to do more specific tests).
So it seems like WinRT is throwing a hissy-fit when it's forced to use the Cisco VPN... not that I blame it - I don't like that VPN myself! :P
Still, I'd like to be able to connect to the test services. Any suggestions on how to tackle this issue?

Related

Unable to connect Google App to Google MySQL

my app is deployed and responds (however, no db connection) but, the pages that do not connect to the database work correctly, including calls to the web service api
my mysql database is running and has a public ip address (also, added my ip address as an authorized network)
i can connect to the google database from my local laptop using the mysql workbench and the instance i created is fully loaded and ready
i am able to run my .net core 3.1 project from my local machine and it runs using the Google MySQL instance via the public ip address
unsure why i am able to run my app locally using the google mysql instance from my laptop but the app from within the google hosting network itself does not.
google claims it should work by default?
however, the only way i have gotten it to work is by adding 0.0.0.0/0 to the allowed network. seems "dirty" that way. but, if i must.
connection string is "Server=34.125.xxx.xxx;Database=testdb;Uid=root;Password=testpword"
error message
You have already gone through the issue yourself. You have tried to make 0.0.0.0/0 an authorized network and it worked! what does this mean? This simply means that you need to authorize the AppEngine outbound NAT gateway cidr to access your CloudSQL instance and it worked because this NAT cidr is included in 0.0.0.0/0 as you may already know.
but the thing is, this is not the best option to secure your connection to CloudSQL.
As quoted from the documentation:
Using the Cloud SQL Auth proxy is the recommended method for authenticating connections to a Cloud SQL instance because it's the most secure method.
The CloudSQL Auth proxy provides secure access to your instances without a need for Authorized networks or for configuring SSL.
See the CloudSQL Auth proxy documentation here
Also,
You do not need to use the Cloud SQL Auth proxy or configure SSL to connect to Cloud SQL from App Engine standard environment or App Engine flexible environment.
See
Connecting from AppEngine standard environment to CloudSQL
and Connecting from AppEngine flexible environment to CloudSQL

How to Connect to Azure SQL Server from WPF application with Azure AD token autentication : avoid Firewall

Now I develop a WPF application that access to Azure SQL Server and work in Windows10 Tablet for my client.
I registered my client IP address of my PC for development,so the application can access to the sql server in development.
But it does not work in the tablet in other network. I know, I have to register its ip address too.
Now I have a problem.. of course, my client use his own network and I can't confirm the ip address he use!
To resolve this problem, I tried to use Azure AD autehntication with token.
(refer to https://learn.microsoft.com/en-us/azure/sql-database/sql-database-aad-authentication , https://techcommunity.microsoft.com/t5/azure-sql-database/azure-ad-service-principal-authentication-to-sql-db-code-sample/ba-p/481467 and so on)
My Application suceeded to login with Azure AD authentication in my PC for development, but in other network it failed yet..
Does it mean that I have to register the ip address in which the application works in any authentication method?
(If yes, it means that all user have to tell his own ip address to developer. No Way!!)
or I need to allow all range of ip address for this application?
I hope your help, thanks
If I understand your question correctly there are two questions:
1. How to make sure that dev machine has access to Azure SQL Database ?
For this, there is no other way. You will have to enable the IP addresses (or range of addresses) from which you want to access the Azure SQL database. If it is not allowed, you will not be able to connect to it.
You can enable this either while creating the SQL Azure instance OR you can also configure these IP addresses later as and when you need.
If you ask me what is the best way, I would suggest to use your local SQL Server for development. That way you do not need to configure all the IP addresses from all the networks from where you can work. This is also very handy as you have database on your machine.
Are you using central database and many people using it, then you have option to either setup a SQL Server which is available to the development team.
Alternatively, if you are interested to use Azure SQL for your development (which I would not recommend), then you can also try setting up a proxy service which just forwards the request to Azure SQL. That way making sure that all requests are coming from one IP.
2. How to make sure that your deployed application will always be able to access Azure SQL database?
It depends on how the application is deployed. If the application is going to be deployed in Azure, then you may want to enable access from other Azure services to Azure SQL instance. This is also setting which you can enable while creating SQL Azure database OR You can configure it after creating the SQL Azure instance.
If the application is not on Azure but database is on Azure, you will have to update the firewall to allow connections from the application.
I hope this provides you enough insights to get to your solution.

Using web sockets in UWP background tasks

I am trying to make a background task for a UWP app. The task should be triggered by packets from a web socket connection.
I have tested the web socket and it works as expected.
For the background task to work, according to the Microsoft tutorial on background networking (Network communications in the background), a ControlChannelTrigger must be instantiated and the channel.UsingTransport(socket) method must be called. Then socket.ConnectAsync(...) should be called.
However, when calling socket.ConnectAsync(...) after channel.UsingTransport(socket), the socket.ConnectAsync(...) method throws an exception with the following message.
Exception from HRESULT: 0x80072F75
When called without channel.UsingTransport(socket), the connection is established without problems.
In order to use the socket in a background task, I must establish the connection after calling channel.UsingTransport(socket).
Can anyone shed some light on why this error might be occurring?
Please don't install the IIS server on the same device and use localhost to connect the server. See network isolation topic. When using the server in official WebSocket sample , you can try to copy the server folder and its subfolder to another computer and run the server scripts, then you can connect the server with a IP address such as:
Server uri: ws://xxx.xx.xx.xx/WebSocketSample/echowebsocket.ashx
Besides, please have a try to test the ControlChannelTrigger StreamWebSocket sample.
Also see the Note part in the sample:
When used with the supplied scripts, this Windows Store app sample communicates with another process (IIS server which is a desktop app) on the same machine over loopback for demonstration purposes only. A Windows Store app that communicates over loopback to another process that represents a Windows Store app is not allowed and such apps will not pass Store validation. For more information, see How to configure network isolation capabilities.

Client PC communication with a Host PC over LAN

Short Verstion: I have a task that I need to make an application get a computer's camera screenshots, and send to another computer running a Windows Service, in the same local network (but not connected to the internet), along with some other information.
Long Explanation: We have an application that runs in the background while the user takes a survey, and we get the user's information such as ID and we save his answers along with other information (only pictures at the moment).
We convert these pictures to data and send them to a WebService, which then saves in a server.
Now we're implementing an "offline" version of this functionality, and we're supposed to save the user's data to a specific computer in the local area network, running another application that saves these data to later upload them to the server when it's online.
Question What do I need on both PCs for this communication to work?
Is it possible to access the Windows Service in the Host PC if it doesn't have IIS installed? (It'll be a client machine so it probably won't have it).
I've been trying to google to understand what should I search/understand but I couldn't find anything that wasn't about WCF and IIS / Online services.
you need some form of communication between the 2. It could be TCP/IP sockets or WCF or classic webservices... but if it is webservices then you DO need it hosted in IIS just like WCF. But WCF allows you to not only host it in IIS but it can be self hosting in your application or you can also use the Windows Activation Services (WAS) too. TCP/IP sockets can also be a solution here. I would lean towards TCP/IP Sockets as the problem you describe is more suited for this than a full bloated service.

How to run TCP Sockets application from different computers

I would appreciate if someone could help.
I have written a Client/Server Sockets application. The client is Windows Forms C# app and the server is a C# console app which runs locally. The client application has a login form containing the field with generated port.
When user logins he is connecting to the server using that port and the server continues listening incoming connections.
Everything works fine when I test my application simply running several instances of Visual Studio project on one PC. Now, I would like to test it on several PCs and I am very confused here.
I would be grateful if someone could explain in simle words how to run my app on two machines.
How do both users connect to the same server? Where should it be located? Should the server have one IP and different ports per one users group?
Also, my application uses SQL Server Database which is installed locally on one PC. So the application uses connection string with that PC Name. In case of two PCs is it possible to connect the second computer to DB on first PC?
I am sorry if this sounds silly :)
Thanks a lot
So if I am correct you are wondering the following three things?
Q1. How do I test my software in a multiple machine environment.
A: This is perhaps not really a Stackoverflow question but what I would do in this case is to have a small setup in Hyper-V with several machines with different operating systems that all have a shared folder that I can deploy my code to. Of course for more extended testing you would need to get more machines and copy the executables to that machine for testing for the first stage and perhaps write a setup software for the second stage of testing, but that depends on the how much testing you actually do.
Q2. How to I allow several users to connect to my service?
A: I think that Anthony Horne has a great answer to this in the comments - Tell your service to listen on port X and when a client tries to connect open a new communication instance on port Y and ask the client to call back to that port. This is as far as I know industry standard for solving this type of problem.
Q3. My application uses a SQL Server Database can I allow clients to connect to it remotely.
A: Yes you can. Please see this Stackoverflow question.

Categories

Resources