Launch program on server through web - c#

OK, so I'm in a strange development situation and am a noob at the bits I'm tasked with - just to make life fun and interesting.
My fellow developer has written programs in VB.Net and placed them on the server. He wants a web front end that users can click a link and have that run the program on the server.
Sounds simple, but I've spent days searching the internet and found only two solutions one of which looks sketchy on security and the other is so complex I'm not sure how to make it fit my local variables.
I'm writing ASP.Net on an MVC Framework using C#.
So, in terms for the simple minded to understand, is there a way to do this? Are there links which I used the wrong keywords and completely missed? Or even a suggestion on which tech docs to look at to try and track this down.

I would have your fellow developer convert his application to a library that you can reference in your c#.. Doing what you want to do does not sound like a good idea at all and I would avoid it at almost all cost.

I have had similar requirements.
How I handled it: write another program that runs in memory on the server and is looking at my database (or file system) on a schedule. The ID of the application to run is then added to the DB/Filesystem from the web page; during the next scheduled check (mine checks every 5 seconds) any scheduled applications are run.
It isn't a direct execution, but gets the job done and is very straightforward.
FYI: My requirement was to do some office automation task.

Related

Throttling network for other applications

A friend likes to limit his applications to a use a certain bandwidth-limit. Seen as he doesn't have the widest connection and - for example - not every application that downloads/uploads has the ability to throttle/limit their downloads/uploads (Like Steam or a torrent downloader.). So he was wondering if I could maybe put something together since I fiddle around with WinForms often. I recommended NetLimiter and NetBalancer, but I was curious as to whether I could make this in C# myself.
I have searched the web and found some decent solutions as to throttling in an application itself but as to throttling applications outside of the current application you have the source code of, I haven't been able to find anything that would help me understand how to program this from scratch.
Do any of you know how I'd go about throttling other applications? Would I have to write my own network interface and have Windows reroute traffic through that?
Thank you for your time.
EDIT: Seen as the first comment tells me I'm at the wrong address with C#, I rephrased my question in the hopes of a better way to get an answer.

What would be the best way to generate website from db

We have a lot of red tape to handle before any changes to anything can be made on our servers. Hence I'm looking for ideas and/or suggestions for the below situation.
Must generate html from db (MSSql Server) for a static website hosted on IIS 6/7.
No (external) changes should be necessary on the server side except the ones the application/website makes itself.
I tried markdown and it generates everything nicely but I could not find a way to make the above idea applicable with it. I am willing to put all html code in the db for each individual page but it sounds awkward. Should I go with something ASP.NET'ish or a Windows Service or a standalone app to run at a schedule.
Thanks for the suggestions.
ASP.NET Dynamic Data might be your technology of choice.
http://msdn.microsoft.com/en-us/library/vstudio/ee845452%28v=vs.100%29.aspx
However, my advice is that you'll never be able to solve your problems by something like the above. You need to work out how to do releases more often - maybe start with a CI server and start scripting your releases if you haven't already.

Offline synchronization options with .NET

I've been asked to research approaches to deal with an app we're supposed to be building. This app, hypothetically a Windows form written in C#, will issue commands directly to the server if it's connected, but if the app is offline, the state must be maintained as if it was connected and then sync up and issue data changes/commands to the server once it is connected.
I'm not sure where to start looking. This is something akin to Google Gears, but I don't think I have that option if we go a Winform route (which looks likely, given that there are other functions the application needs that a web app couldn't perform). Is the Microsoft Sync framework a viable option? Does Silverlight do anything like this? Any other options? I've Googled around a bit but would like the community input on what's best given the scenario.
The Microsoft Sync Framework definitely supports the scenario you describe, although I would say that it's fairly complicated to get it working.
One thing to understand about the Sync Framework is that it's really two quite distinct frameworks shipping in the same package:
Sync Framework
ADO.NET Sync services v. 2
The ADO.NET Sync services are by far the easiest to set up, but they are constrained to synchronizing two relational data stores (although you can set up a web service as a remote facade between the two).
The core Sync Framework has no such limitations, but is far more complex to implement. When I used it about six months ago, I found that the best source to learn from was the SDK, and particularly the File/Folder sync sample code.
As far as I could tell, there was little to no sharing of code and types between the two 'frameworks', so you will have to pick one or the other.
In either case, there are no constraints on how you host the sync code, so Windows Forms is just one option among many.
If I understand correctly, this doesn't sound like an actual data synchronization issue to me where you want to keep two databases in sync. it sounds more like you want a reliable mechanism for a client to call functions on a server in an environment where the connection is unstable, and if the connection is not present at the time, you want the function called as soon as the connection is back up.
If my understanding is right, this is one option. if not, this will probably not be helpful.
This is a very short answer to an in-depth problem, but we had a similar situation and this is how we handled it.
We have a client application that needs to monitor some data on a PC in a store. When certain events happen, this client application needs to update our server in the corporate offices, preferably Real-Time. However, the connection is not 100% reliable, so we needed a similar mechanism.
We solved this by trying to write to the server via a web service. If there is an error calling the web service, the command is serialized as an XML file in a folder named "waiting to upload".
We have a routine running in our client app on a timer set for every n minutes. When the timer elapses, it checks for XML files in this folder. If found, it attempts to call the web service using the information saved in the file, and so on until it is successful. Upon a successful call, the XML file is deleted.
It sounds hack-ish, but it was simple to code and has worked flawlessly for five years now. It's actually been our most trouble-free application all-around and we've implemented the pattern elsewhere successfully

Feasibility of ASP.NET based MMOG

I want to develop ASP.NET C# based MMOG (Massively multiplayer online game). I would be using ASP.NET Ajax control kit, jquery and MS SQL server 2005.
Q.1)How feasible .NET 3.5, ASP.NET with C# in handling thousands of users simultaneously.
I would also incorporate ASP.NET ajax based chatting system with chat rooms alongside the MMOG.
Q.2) Do you know any of the sites (MMOG) using ASP.NET ?
Q.3) What are the best practices for Chatting System as mentioned above?
ASP.NET and MSSQL 2005 definitely have no "built in" scaling problems. You will have to take care to build you application right and be prepared to dish out some money for proper hardware.
See for example the hardware setup that is scheduled to tackle the stackoverflow load.
ASP.NET can handle it with the proper server configuration, hardware, and performance considerations when creating the application.
I tried to do some googling and didn't find anything right away, but I'm sure that there are some out there.
For the chat piece you might look at a product such as CuteChat that already exists and has been tried and tested for a long time.
I would think about using Silverlight instead of the AJAX-based stuff. From a UI perspective you'll be able to do a lot more.
ViewState will end up being your end game raid boss unless you disable it or switch to ASP.NET MVC.
Maybe today you start with a html/javascript/jquery UI and tomorrow you throw on a fancy Silverlight or Flash UI.
AjaxControlToolkit is pretty bloated and kinda hard to customize. With an MMO, speed is going to be a priority, so you'll want as much control over your postbacks as possible.
You also might try looking into Silverlight for your front end. It integrates well with the .NET environment, and would be a lot easier to develop your interactive pieces with.
Plenty of bigass websites running ASP.NET. I'd HIGHLY recommend using the new MVC framework, as it reduces the complexity of ASP.NET websites greatly.

Track used applications

I've been using Wakoopa recently, and I find it quite amusing.
I had no idea ( well I had an idea but never got real data about it ) on how much time I spend in SO until this:
alt text http://img396.imageshack.us/img396/4699/wakoopaim1.png
So my programming question is:
How can I programmatically track the applications being used?
My initial though was to use something like "tasklist" command and "netstat" and pool every 15 minutes or something like that, but I don't think this is the way they're doing this.
Is there a library in .NET ( in C# I guess ) to do this? Does windows provides some kind of service like this? What about java?
I usually have at least some vague idea on how some programming task could be performed, but for this I don't have a clue.
The wakoopa app tracker works on OSX and Linux too, but it is clear to me they are three different apps, one per platform
BTW, how much do you used SO? :)
Here is a link to an article with source covering the Process Structure Routines API Detecting Windows NT/2K process execution. I thought that the SysInternals site had source to Process Monitor, but I don't see any. The article should point you in the right direction for Windows systems.
Here is a link that may be helpful for Linux systems PROCPS
Here is a link to a java swing top utility Monitor It uses JNI, so not sure if it really fits as a java solution.
And to answer the SO question, I only periodically visit the site. I find I spend too much time on it if I visit regularly.
Familiarize yourself with the Server Explorer in Visual Studio -- look under 'Process'.
Then read up on the PerformanceCounter class.

Categories

Resources