iPhone, WMI, iis service - c#

I am thinking about writing an application that will monitor IIS Service with iPhone, and send notification, perform resets if an IIS goes down.
I dont want to create a web service to do that but rather connect to a machine, specifying credentials and then get data from the IIS Service state.
Is it even possible?
Is it possible with iPhone?
I need to make this app generic enough for people to use with their hosted web sites and monitor their health and being able to reset it and/or recycle AppPools. I cant implement a service for any hosted environment. I need to be able to give the iPhone users an ability to connect to their host and once you are connected to the machine and authenticated to perform WMIs the phone users can mess with the iis. Is it possible?

I see your point not wanting to use web service because you want to monitor and reset IIS service, while web service is based on IIS. How about RestFul service? I have created RestFul service based on OWIN (Open Web Interface for .Net) and Kayak. Kayak may have some examples there.
The cool thing about those tools or lib is that the framework is very simple and does not rely on IIS. You can provide two URLs, one for get and one for post. The former is to get status of IIS server and post is to reset IIS. Those services can be just XML of JSON based objects and it will be up to the the OWIN service to do the job on the back end. Another great feature of this is that you can even create the service in a console app or any other ways (Windows service or Window Form in system tray) on WindowsXP or Home version. The app will provide RestFul service based on HTTP with specific port.
RestFul service is available for variety of platforms, including iPhone.

Although IIS supports remote administration I doubt there's a way to implement it on the iPhone easily.
You could write an actual Windows Server (not a web service) you could connect to with a socket which can do all the monitoring instead though.

Related

Best Approach to communicate between a Windows forms application written in C# and Native Android App

so our company wrote an accounting app,in windows,using c# for a certain company that ordered an accounting application.
after a while,they requested an android app that can communicate with the server and request or send data from or to the database that the windows form application uses,which uses SQLExpress 2014.
note that : the application that runs on the android platform may need run on more than one client at any given time.
AND
the android app will be native.
my main question is this : whats the best technology to use?
do i HAVE to use web services ?
well to do that i have to install IIS on the windows client which is
all im trying to avoid,because i have a setup and the program has been
mass produced within the city so i cant just take back every
customer's product and add iis setup procedures to the setup...if u
know what i mean
Not true. Since WCF days, there's an in-process option called XXX self-host which is a tiny web server written in C# and started along with your process using code.
Currently your best web should be developing your Web services using OWIN/Katana self-host and implement your RESTful service running on a Windows service (did you know about TopShelf?).
Check this interesting MSDN article to learn more about self-hosting a Web API into a Windows Service using Topshelf.
TL;DR
Your best bet here would be creating a Windows service which might be installed along with the Windows application or in some customer's server machine and host this way your RESTful Web service using ASP.NET Web API.
This is easy to deploy and distribute, and your customer won't require an IIS installed to host web services.

What are the limitations , if any , when hosting a WCF service on azure

I wrote a WCF service and I want to host it in azure. When I wrote the service , I didn't have in my mind that I am going to host it in azure.
Every application , even a WCF service , is using platform resources. When I say resource , I mean anything:
memory
CPU
File handle
Low level APIs (pinvoke)
Com objects.
sockets
.Net BCL API (Yep , I even consider this as a resource)
Databases
etc..etc.. (anything that is not the code i have written myself)
Hypothetical example : If the service , for example , logs to Drive 'H' , it may work on my computer(since I have drive 'H') , but it will probably won't work on the cloud. Same for Drive 'C' , or any drive letter , I don't even know how a file system is seen from the service perspective.
This is just one example.
Another hypothetical example : I can pinvoke from the service some winapi method in nt.dll , It will work on my computer. But i guess it won't work on the cloud.
My question is :
How can I know what kind of resources can be used on the cloud and how resources are used when writing to the cloud? What are the "rules" to follow? Also Is there any "Smart" Compiler that can ensure that my service is compatible with the cloud platform
I'll be glad to get any detailed explanation or a reference\book about this topic. I tried to find some info by googling but didn't find anything that cover it well enough.
Once i'll get the details i'll be able to make the nessecary porting to my service (if any needed at all).
The limitations depend on how you host your WCF Service:
Windows Azure Web Sites: This is a shared hosting model. If you deploy your WCF service in a web site you'll need to take that into account. This means you'll have limited access to disk, limited access to low level APIs, no way to use native libraries, ...
Windows Azure Web / Worker Roles (PAAS): Your application will be deployed in a Windows Server 2008 / 2012 VM. So if you want, you can leverage all functionalities you would use on a normal Virtual Machine (all "resources" you mention in your question). The only thing to keep in mind is that these virtual machines are non persisent (meaning all data you store on them could get lost) and that the load balancer is not sticky (could be an issue if you use WCF sessions). The fact that these machines are not persistent also means you cannot install a database server on them in a reliably way, but you can use an external database, like SQL Azure. The advantage of this solution is that the machines are maintained by the Fabric Controller, so you push your service package (the application) to Windows Azure, and the rest of the deployment is done for you.
Windows Azure Virtual Machines (IAAS): You get a machine like in Web / Worker Roles which allows you to use all "resources", but with even more control. The machines are persistent, meaning everything you store on them is persisted in Blob storage (if the machine crashes, you don't loose the data stored on the OS drive and data disks). This is the closest alternative to an on-premises deployment, but this also adds extra work. It will be up to you to manage deployments on all servers, to handle security updates, ... But in this case you could install your own database on a machine. Keep in mind that also here the load balancer is not sticky which could impact features like WCF session.
You can follow below mentioned Guidance for Using WCF in Windows Azure.
Deciding whether to run a WCF service in a web or worker role
WCF services can be hosted in either a web role or a worker role. Which type of role you decide to use depends on the type of WCF service you are writing
Running a WCF service in a web role
A WCF service that is set up for deployment to a Windows Azure web role uses the same setup and configuration as a WCF service hosted in IIS on on-premise servers.
Understanding WCF Security in Windows Azure
The security concerns for hosting a WCF service on Windows Azure is the same as those you encounter hosting the service in on-premise servers
Troubleshooting WCF in Windows Azure
You can troubleshoot performance issues for WCF services in Windows Azure using the same techniques that you use with WCF services hosted on-premise servers
For get more information check Guidance for Using WCF in Windows Azure Here
I hope this will help to you.

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.

Good way of communicating between web and desktop app

I want my web app (running in a browser) to, at some point, communicate (bidirectionally) with a desktop app (in Windows), the client has installed in its computer.
What's an elegant and modular and simple way of doing this (with Java and C#)?
Not much information will be passed between the web app and the desktop app. Just something like "I was here", "Pick this from this point", etc.
I solved that problem by using a database on the network.
All communications where made trough the database.
Website -> DB -> User logged in <- DB <- Desktop
However, if no trusted information needs to be shared, you could consider just posting and reading some http headers to a common website, or a simple log file.
Greetings
I suggest you to use the backend part of your webapp, assuming that your app is based on some backend services.
You have two options:
Your desktop apps use the same services of your web app. You must use a class that mimic a web-browser to give the data (curl, ie). If your web app is based on AJAX push ( APE Server i.e ) use library that is able to run some javascript
Use a REST protocol, with a JSON format in your backend services. It's easy to manage and is supported by many client-side languages (java/c#/python....)
Use a specialized endpoint only for your desktop app,for C#, you can use WCF, that allow you, in one of his forms bidirectional communications. For JAVA, there are WSDL, DWR
My preferred solution is to decouple the web app in a front-end side and a backend side, that expose the services as REST that are used by the web app via AJAX.
If I need true bidirectional communication with other desktop app, I'll create a separate service / endpoint for it. (APE , WCF, ..)
I see several options to achieve part of what you are asking:
Besically you expose the relevant parts of your apps (web and desktop) via some sort of API and use that for the communication - for example DB and/or WCF (SOAP/REST/whatever).
BEWARE:
If you are after some sort of direct/interactive communication between both apps on the same computer then this won't be possible - at least not without some security related issues.
The browser executes your web app in a sandbox which doesn't allow for direct communication between the web app and the desktop... there are technologies which can help circumvent that (ActiveX, signed Java applets, some Flash technology called AIR etc.)... or you could host some webbrowser/control in your desktop app which in turn runs the web app... BUT basically I would recommend against using any such measures...
IF you really want to go this route then please describe your environment and goal with much more detail.

Hosting non web based application in IIS 7

I have heard that you can host non-web based applications in IIS7 similar to windows services. Basically I want a C# app that is just a process running all the time to perform a specific function. I want to create a process that connects to the database at an interval and does some work.
I would like this whole app to be housed inside IIS. Is this possible? Can you provide me with links and resources to get me started?
WCF services can be hosted in IIS. Abstractly, think of them as webservices. Really much more, than that, but it gives you the gist. More information:
How to: Host a WCF Service in IIS
Why we use wcf rather than web services
How To: Hosting a WCF Service in IIS
Take a look at AppFabric it's Microsofts Application Server
http://msdn.microsoft.com/en-us/windowsserver/ee695849.aspx
http://www.hanselman.com/blog/InstallingConfiguringAndUsingWindowsServerAppFabricAndTheVelocityMemoryCacheIn10Minutes.aspx

Categories

Resources