connect ASP.NET application to windows service application - c#

I have one windows service application and one ASP.NET web application, both created by C#.
Both applications get data from the database(SQL server).
Once I update database from web application, how could I inform service application to reload data from database?
Right now our solution is to use service controller to restart windows service application. Is there any low cost solution, like communication between service application and web application?
By the way, my boss hate polling method...
Thanks a lot!

You could use a table like a queue between the web page and the service.
When the page modify some data will flag new record in the table, the service will review that table each X seconds, if find a new record, will change the state and run any process you want.
Hope this help.

Related

Create a web page to control a C# windows form application

I have developed a C# windows application with Visual Studio 2013. It runs on a server and communicates with some devices around the world through a Apache server(txt files which contains commands). Now I would need to create a web page(accessible via the internet) which allows my customers to log in and change some parameters which are in my windows application.What would be the best way to do it?
Thank you in advance for your help!
Create a web page to save customer settings in database
Expose a webservice or Web API that can be called from the desktop application in a different thread to access the customer data from the web

How the silverlight business template can login into the application?

I'm a bit confuse when the user is trying to login into the Silverligh Business application.
In my database, I've got two tables called Students and Teachers, and I've got a view called UsersView where I do an union between these two tables (and this view or query, has just as attribute Id).
I need to use this view in my silverlight business application to verify if the user exists. I've seen that many projects are using WFC RIA Services, in fact I was thinking to call directly to my database but I'm really confuse.
Can someone tells me if it's necessary to login through AuthenticationBase?
Silverlight cannot call directly to a database since it's a client side application. It HAS to go through an intermediary WCF service, or you can use WCF RIA services to get some functionality out of the box. A silverlight business application template should come with two projects, a silverlight one that produces a client side .xap and a web project. If you go to properties on the silverlight app it should show a RIA services link to the web project. If you run it, it should (if I am not mistaken) create a temp database using a sql express instance to login and validate users. So, long story short. Yes, you have to login using AuthenticationBase. Logins can only happen on the server. So you have to wait for the silverlight app to communicate to the server, validate against the db and then submit a response through RIA. Hope that helps.

Architechting a complete web service, website, and iphone app

I am trying to architect a system that will have a website and an iphone app that will be driven off the same data. I understand how I would create and architect the website, but when it comes to adding the iphone app I am unsure on how it will apply.
My considerations for design:
-Using C#, SQL Server, asp.net for the website (would try to get most of my data using web services where I could)
-Using Objective-C, x-code, etc for the iphone app development
1.) Will I need to expose a web service for the iphone to interact with? If so, would that be considered a seperate web app from the actual website? Or would the webservice be built in with the website and then the iphone would interact with that web service as well?
2.) What do I need to consider, security wise, when it comes to exposing a web service?
3.) Any other architecture advice for building a system such as this? Maybe personal experiences with doing a website/iphone app that runs off the same database.
Yes you will need to expose a webservice for the application to bind/talk to. I would suggest that the service be run as a separate site (such as data.yourdomain.com, where as the site would run on yourdomain.com) which the website also uses for it's data. That way you share the same architecture for both your "end points" (site and app).
Ensuring that you webservice takes a authentication token (username/password or oauth/etc) with each call will help to prevent any unauthorised calls to the service/database. Also ensuing that your service is exposed via a valid HTTPS connection (and only https) will prevent sniffing of the data to get passwords.
As I said in point 1, build the service in such a way that it does not matter what "end point" is accessing it. That way should you add an android app or windows phone app (or even a second website) you will not need to make a fresh service. Perhaps tie each applications "account" to a "end point type" (such as Android/iPhone/WinPhone/WebSite) that will allow you to customise the data objects that you return if needed.
Will I need to expose a web service for the iphone to interact with?
If so, would that be considered a seperate web app from the actual
website? Or would the webservice be built in with the website and then
the iphone would interact with that web service as well?
It depends, if you want a native application, then you would expose the service, else you can develop an iPhone web app
What do I need to consider, security wise, when it comes to exposing a
web service?
Normal security consideration as if you would develop a web service to a windows desktop application
Any other architecture advice for building a system such as this?
Maybe personal experiences with doing a website/iphone app that runs
off the same database.
Try to make the web service as clear and light as you can
At first use use just one data source for all your projects. Expose the database with webservices. User authentication to invoke webservice procedures for security.

Displaying information from a windows service in asp.net web forms

What i want to do is running a windows service (c#) which gathers some information which i want to display in my asp.net web forms site. The windows service has a timer so that code can be run periodically.
The purpose of my application is to manage windows services (restart, check if they are stuck etc.). Furthermore there is the exact same monitoring service on a different server which checks the other one (monitoringService1 monitors monitoringService2 + some normal services and vice versa). This is why the monitoringService is a service too.
Can you guys give me any hints how i can pass my data from the win service to my web forms?
Thank you in advance!
best regards,
r3try
You can store the data from the results of your Windows Service in a log or a database, then read the same data from your asp-net application. I would recommend the database way.

one web application multiple database for each client difficulties with recognizing clients Request.Url.Host

I have one asp.net(iis7) web app and multiple database in back-end.
Every client has different url for example:
client1.test.com
client2.test.com
Application should read url (HttpContext.Current.Request.Url.Host) and determine which database use.
The problem is that from iis7 HttpContext.Current.Request.Url.Host in class not working(Request is not available in this context ).
I don't have idea how to replace this mechanism.
One web app for every client is not a solution.
Problem solved:
From IIs7 (integrated mode) Request.Url.Host is not available
in application start event.
It works later but if you need any initialization in application start you can read blog entry
http://mvolo.com/blogs/serverside/archive/2007/11/10/Integrated-mode-Request-is-not-available-in-this-context-in-Application_5F00_Start.aspx

Categories

Resources