I created localhost website in asp.net in Visual Studio and i added there a MSSQL connection.
My problem is that I created an app for windows phone 8 but i dont know how to connect this app with database which is on this website.
Can you help me with this?
First of all: your Windows Phone app can't connect to a SQL Server database, so you'll have to create an API.
Since you're using ASP.NET, I suggest to have a look at Web API. In short: you'll have several URL endpoints which return json/xml to your Windows Phone app. It's your job to query the database and return a single item/list of items in the controller of that URL endpoint (this sentence will make sense if you read into creating a Web API).
Next task is connecting to this API. Normally you would host it on a public url, so your phone device can connect to it (a phone doesn't know about your pc's localhost). If you want to use localhost with the emulator for testing, you'll have to execute the tasks mentioned in the quote below as this doesn't work out of the box.
When you create a WCF web service in Visual Studio, by default the
service is hosted in IIS Express and only accepts connections at
http://localhost/. Apps that target Windows Phone OS 7.1 can connect
to the development computer as localhost because the Windows Phone 7.1
emulator uses the network connection of the development computer. The
Windows Phone 8 Emulator, however, configures itself as a separate
device on the network. As a result, an app running on the Windows
Phone 8 Emulator can’t connect to the development computer as
localhost. Before you can connect successfully from the emulator to
the local web service, you have to make two changes:
You have to configure the local web service and web server to accept connections from other devices on the network.
You have to configure the service reference in the Windows Phone app to connect to the service by using the IP address of the development
computer on which the service is running.
Source: https://msdn.microsoft.com/en-us/library/windows/apps/jj684580(v=vs.105).aspx
Related
I have an ASP.NET Core MVC application, that i want to connect it to POS ( Point of sale) device, and send payable price to pos and then pos send back me the result.
I want to run these operations on client system. how can i send data to ports of client system?
Before I had the same problem. your web application can't communicate with the port directly.
To do that you have to do the following :
1-Create a windows service project
2-Host a web Api in windows service (Web API Self-Hosting Using Windows Service)
That way your web application can call web api hosted in windows service, because web api is listening to the incoming requests. in web api, you can communicate with your desired port directly and send the result to the client.
Finally, to use this feature in your web application you have to prepare a batch file(it runs your windows service) of your windows service project and put it in the download section of your website.
if any user wants to use POS( Point of sale) device have to install the bat file
I started coding an ASP.NET webapp (with Visual Studio 2015). I'm having problems with the connection to my Azure SQL database. I can connect to the database via MSSM Studio.
When I publish my app on the Azure webservice the app works fine. When I run my code locally I keep getting the following error:
SqlException: Cannot open server 'database' requested by the login. Client with IP address 'XX.XX.XX.XX' is not allowed to access the server. To enable access, use the Windows Azure Management Portal or run sp_set_firewall_rule on the master database to create a firewall rule for this IP address or address range. It may take up to five minutes for this change to take effect.
Altough the firewall of the database service is set (I've even tried with range 0.0.0.0 too 255.255.255.255). On my computer port 1433 is allowed.
Any help is deeply appreciated.
The problem was solved by editing the username of the database connectionstring.
my_username#my_app.database.windows.net -> only worked published on Azure (not via localhost)
my_username#database.windows.com -> works published on Azure and with my localhost
Im trying to let two uwp apps (windows 10 apps) communicate while running on the same machine. The Apps already can communicate when run on different hosts, so the code is working (both apps are enabled to communicate in local and public networks declared in their manifest files).
When running on the same host however, the client application is not able to connect to the server.
Im using Visual Studio 2015 Community Edition Update 3 for developing.
Under ProjectSettings->Debug->Allow local network loopback is checked.
I tried to ad an LoopbackExempt via commandline (for both apps):
checknetisolation LoopbackExempt -d -n=<packagefamilyname>
But still not working.
The code im using (thought might not be relavant)
Serverside code:
var listener = new StreamSocketListener();
listener.ConnectionReceived += Listener_ConnectionReceived1;
await listener.BindServiceNameAsync("20000", SocketProtectionLevel.PlainSocket);
Clientside code:
StreamSocket socket = new StreamSocket();
_hostName = <hostname/ip>;
await socket.ConnectAsync(new HostName(_hostName), "20000",SocketProtectionLevel.PlainSocket);
The loopback exemption will allow the app to connect out to the local system as a client, but it won't let the app receive local connections as a server.
See the Note on MSDN in the article How to enable loopback and troubleshoot network isolation (Windows Runtime apps)
Note Loopback is permitted only for development purposes. Usage by a
Windows Runtime app installed outside of Visual Studio is not
permitted. Further, a Windows Runtime app can use an IP loopback only
as the target address for a client network request. So a Windows
Runtime app that uses a DatagramSocket or StreamSocketListener to
listen on an IP loopback address is prevented from receiving any
incoming packets.
There are several other options depending on what exactly the need is. The most likely two are:
If the goal is only for testing then run the apps on different systems.
If the goal is IPC then implement an App Service. App services are specifically designed for UWP to UWP communication
If you're side-loading (which you'd need to be doing to call checknetisolation anyway) then you can also look into adding a brokered Windows Runtime Component or a desktop app as a broker server which both clients can connect to, but I'd definitely check out the app service option first.
I'm setting up an ASP.NET MVC5 application on a Windows Server 2012 VM running .Net 4.5 and IIS8. I've always leverages Azure for App and DB services (thank you Azure for your seamless 10 min server setup and publishing solution!) however I need to host this app using this alternative method. The VM is not an Azure VM. I've managed to configure the VM and publish the application (10 hrs of head banging experience... ) however when the application attempts to make a call to the Azure Db during the form registration process I receive a time out error; "The wait operation timed out".
My question is; I can access the application via the ip address from my local machine, I think port 80 is open by default. Do I need to specifically target this port in the applications web.config file for I/O calls?
If you want to connect a non-Azure Virtual machine which is behind a firewall to the resources in Azure, you will have to create a virtual network with either site to site or point to site VPN enabled. Please check this link which explains how to do it. https://azure.microsoft.com/en-us/documentation/articles/vpn-gateway-howto-site-to-site-resource-manager-portal/
My webapplication hosted on windows azure needs to communicate with TFS Server.
my webroles connect to TFS using a uri similar to (http://ed12-ektfsp-01:8080/tfs/eeol/ )
While on azure I found that my webrole failed to communicate with tfs server.
Do I need to enable "azure connect" for for my azure webrole to
communicate with tfs ?
Do I need to remote into my tfs server and
install azure connect into my TFS server for the azure connect to
get enabled ?
Why azure cannot communicate using
"http://ed12-ektfsp-01:8080/tfs/eeol/ " ?
Your web application does not know the server ed12-ektfsp-01 (I'm assuming this is a server in your datacenter/in your internal network). But there are a few options to allow your web application to connect to this server even if it isn't hosted in Windows Azure:
Configure your firewall to allow traffic from the internet to reach the server ed12-ektfsp-01. This is probably something you do not want to do, unless the server is already available (maybe for developers working at home). Then instead of using the machine name, use the public domain instead (like tfs.mycompany.com) if it's available.
Like you already mentioned, use Windows Azure Connect. This allows you to create a secure tunnel between your roles and your datacenter/internal network. You'll be able to connect to ed12-ektfsp-01 even if it's not exposed to the internet through your firewall. In order for this to work you'll need to install the agent on each server you want to connect to your role, this includes your TFS server.
You can connect your role to a Virtual Network. Then you can use a VPN device on-premises to create a site-to-site VPN connection to this Virtual Network. See the tutorial here: Create a Virtual Network for Cross-Premises Connectivity
You can use Service Bus Relay. This allows you to create a WCF service that calls TFS and host that service within your datacenter/network, but publish it to the cloud. Your web application will be able to consume the WCF service as if it were hosted in Windows Azure.
Please take a look at my answer to this question.
As for your specific questions:
Do I need to enable "azure connect" for for my azure webrole to
communicate with tfs ?
YES.
Do I need to remote into my tfs server and install azure connect into
my TFS server for the azure connect to get enabled ?
YES. And add both the WebRole and the TFS Server into single Connection Group.
Why azure cannot communicate using
"http://ed12-ektfsp-01:8080/tfs/eeol/ " ?
Because the address given is known only within your corporate network, and only resolved by the Company's DNS server. Noone outside can access this address.