I need to make an application where a mobile web app can connect to a local web service in a LAN. For example, several locations are running this web service on their own local server. When someone with the mobile app comes into the location they can open it up and it will somehow be able to connect to that local webservice through WiFi. The mobile app won't know the IP of that webservice ahead of time. Any thought on how to go about this? This will be a .NET webservice and HTML5 app but I don't think that matters.
As mentioned in the comments you will probably have to make it configurable by the user as the will ultimately need the address of the server.
There is however another approach that you can take. Develop a small multicast/udp service that broadcasts the web service address every 10-30 seconds. In your android application register a broadcast receiver that responds to the network connectivity status and runs in the background.
This service on the Android service will pick up the address from the UDP broadcasts and then configure the application.
Related
I have made an angular application that will run in a secured network. This application also shows push notifications upon some operations. But the problem is that this application is showing push notifications when run outside the secured environment and not in the secured environment.
By secured network / environment I mean, there will be checks on the eligible links that a user can open on the secured network. So, I have a doubt that the service, which could be a HTTP link or some other protocol, that is responsible for getting the push notification to the machine and browser from web push servers need to be whitelisted by the administrator. And I don't know what are those links and ports and they are not mentioned anywhere (as per my knowledge). I need those links and ports for chrome, firefox and edge web push service which could improve this situation.
Thanks for any help in advance.
I am creating a web app. I want to create a listening service (TCP) that listens continuously and updates web page according to that.
A Windows service or a WCF service?
At the end I just want a background service that listens on a socket continuously and update data in database. and when database is updated I will use signal r to show that in my page.
Right now I am trying with WCF but I am wondering if it can be done with Windows service also. And right now this application will work on LAN. But in the future, it can also be in the cloud.
First of all, it is important to understand that a Windows service and a WCF service are not the same.
A Windows service is a specialized executable that runs in the background on Windows.
A WCF service is a specialized piece of code that exposes some functionality through a well-defined endpoint. It does not run on its own, but instead must be hosted by some parent process, like IIS, a desktop application, or even a Windows service.
In thinking about the problem you've described, I suppose the most fundamental question to ask is whether or not you have control over the data that will be received via the TCP connection. WCF is built on the notion of the ABCs (Address, Binding, and Contract), all of which have to match in order to facilitate data exchange between WCF endpoints. For example, if you wish to expose a WCF endpoint via IIS that accepts TCP connections from some remote WCF endpoint, the remote WCF endpoint needs to send data to your IIS-hosted WCF endpoint using the agreed-upon data contract. Absent that, WCF will not work. So, if you cannot define the data contract to be used between WCF endpoints, then you'll need to find another option. An option that will work is to open a TCP listener within a Windows service, process the data as it is received, update your database, and listen for more data.
================================================
By way of example, I work on a project that has a front-end desktop application that communicates with a back-end Windows service. We build both the application and the Windows service, so we have full control over the data exchange between the two processes. At one point in time, we used WCF as the mechanism for data exchange. The Windows service would host a WCF service that exposed a NetNamedPipeBinding, which we later on changed to NetTcpBinding to get around some system administration issues. The application would then create its own endpoint to communicate with the WCF service being hosted within the Windows service.
This worked fine.
As our system got more mature, we needed to start sending more and more information from the Windows service to the application. If I recall correctly, I believe we experimented with streaming within WCF and concluded that the overhead was not something we could tolerate. So, we used WCF to exchange commands and status information between the application and the Windows service, but we simultaneously used a TCP socket connection to stream the data from the Windows service to the application.
This worked fine.
When we got a chance to update the Windows service software, we decided that it would be better to have a single communication mechanism between the Windows service and the application. So, we replaced WCF altogether with a TCP socket connection that uses a homegrown messaging protocol to exchange information in both directions - application to Windows service and Windows service to application.
This works fine and is the approach we've used for a couple of years now.
HTH
I am in a stage of using SignalR in my project and i don't understand when to use Self hosted option and when we should not use. As a example if I am willing to host my web application in server farm,
There will be separate hosting servers
Separate SignalR hubs in each IIS server
If we want to broadcast message into each client, how this is working in SignalR
The idea with SignalR running in multiple instances is that clients connected on instance A cannot get messages from clients connected to instance B.
(SignalR scaleout documentation)
However, when you scale out, clients can get routed to different
servers. A client that is connected to one server will not receive
messages sent from another server.
The solution to this is using a backplane - everytime a server recieves a message, it forwards it to all other servers. You can do this using Azure Service Bus, Redis or SQL.
The way I see, you use the self host option when you either don't want the full IIS running (because you have some lightweight operations that don't require all IIS heaviness) or you don't want a web server at all (for example you want to add real-time functionality to an already existing let's say forms application, or in any other process).
Be sure to read the documentation for self-hosting SignalR and decide whether you actually need to self host SignalR.
If you are developing a web application under IIS, I don't see any reason why you would want to self-host SignalR.
Hope this helps. Best of luck!
I have developed a desktop application in c# which send SMS by using an api, It has two button controls 'Send SMS' and 'Stop SMS'. This application is running on a Microsoft SQL server 2008 R2 and I have assigned an Static IP also.
Now my question is that, can I access this application using a web application, means can I control both buttons functionality over web site if I create one and host is from the same server?
Yes. You can make your application to listen spesific port and your web app can send requests to that IP and Port.
As Mike said, actually you should be able to reuse the business logic codebase of your Desktop-Application.
But if this is no option, you also could use named pipes for communcation between the several processes, where you desktop application would be the server, that the wep application would connect to.
May have a look at here:
http://msdn.microsoft.com/en-us/library/bb546085(v=vs.100).aspx
I have a web application and on that application i update a sql database ...what i want is that when i update the database from the web application a notification will be sent to any one openening my application or a pop up appears to them on their desktop informing them that the database is updated to check all this will be in an intranet.
I'm using ASP.Net and I'm the admin for all the PCs in the network and the server.
Does anyone knows how i can do this ?
Build a desktop application that polls the database regularly or better write a HTTP/REST service where desktop application poll frequently.
What you need is a WCF duplex service your website and your windows clients connect to. With such a service you can use callback methods to inform your windows clients through the service. But be aware that this is normally an intranet and not an internet scenario because such an wcf binding has problems with internet infrastructure (Proxies, Firewalls, ...)