C# website, am I forced to use IIS? - c#

I've been thinking for a while about which language to use on my next project. Usually I default to PHP on my LAMP server, but I'd really like to use C# (mainly because of code reuse), and ideally still sicking with Apache. Has anyone used mod_mono on a live project, and if so what is the performance like? The site is likely to get smashed to bits in terms of traffic.
Am I forced to go IIS if I want C#? If not I'll stick to PHP via LAMP as usual.

The answer is "no, one is not forced to use IIS for a C# website". The suggestions above are mostly in alpha/beta development stage however and so using c# for a production website isn't advisable yet.

Related

Implementing a Web Service Server in Windows CE 2013

I have a smart device (Windows CE 2013) that just got the requirement to be controlled from a number of different devices, to do this, we decided to serve a web page from the device that allows it to be controlled.
I've also read that compact framework doesn't support ASP.NET so I'm intending to serve a static webpage that contains a javascript application that calls web services hosted on the device.
I also found this link explaining how to serve a SOAP Service in C++, but it seems old, and I'd prefer to do this in C# as it's my preffered language and I already have some code on it
I'm not quite happy with this solution, am I missing something? Can't I really do this in C#?
You could try this library for .NET https://github.com/ServiceStack/ServiceStack .
It is a free in case if you are using branch v3 form a github.
There's nothing built-in in the CF that provides web server capability. Windows CE has always shipped with an HTTPD server, but, honestly, it sucks and can't be integrated with managed code anyway.
We solved this problem long ago by creating our own IIS-like web server implementation (available commercially). You could do something similar as well - it's just a lot of Socket work. That trivializes the complexity of concurrent request handling and providing an IIS-like object model, but you get the idea. Basically you have to write the whole thing.
The main answer to this is to use Mongoose (or the MIT-licenced equivalent Civetweb). They are C webservers designed for just your task - an embedded web server.
They are really easy to implement, 1 C source file added to your project, give it an array of options, and you're done. See the examples. It has plenty of features and is fast, and small (40kb compiled!). They say it takes 5 minutes to get going with it, and they're right - I tend to use it to add webserver functionality for normal applications now.

How to automate development machine for MVC IIS

I don't know if this is entirely possible as a one click and done option, but what I would like is to automate our IIS MVC development setup for new developers.
Basically, what I am looking for is:
App pool creation if one is not already created (and make sure it is the correct version of .NET 4.0)
Creation of an IIS Application under the above app pool that points to the source code
Figure out if aspnet_regiis -i is needed (in the case that IIS was installed before 4.0 code was introduced)
I am not looking for a publish option as that does not point to the source code. Also, I am not looking to use the built in VS host as I am trying to use IIS to make sure everything is set up appropriately. Maybe I should not impose these limits and do not need to worry about setting up the machine as described? But if this does sound correct, currently I am looking for a way to set this up straight out of source control? Is that possible, or do I need to have an initial setup phase for all new developers?
Although I can't yet write exactly what you want, Powershell will do what you want. Here's a tutorial for creating web sites and app pools.
http://learn.iis.net/page.aspx/433/powershell-snap-in-creating-web-sites-web-applications-virtual-directories-and-application-pools/
What I would suggest is setting up the full environment on a computer then making a boot disk to return to that environment. Then run that boot disk on another computer (note: must be of the same type) which you want the environment to be on.
If it must work for different computers, and different operating systems, then the complexity of allowing for the environment to all be done at once will become greater than just doing it yourself unless you are setting up environments as frequently as daily. If that is the case, then perhaps you could make a custom installation program to do that which I am not very familiar with off the top of my head.

java vs C# web service clients

I've been doing java web services for a couple of years here and there and I've always heard about the ease of use of C#.Net Soap-WS clients. I just tried it out and I have to say, I am a bit jealous - having had to fight through generated code with both Axis and CXF (try using Axis in OSGi or with NTLM authentication...or just look at the horrible generated code, or try using dynamic URL's in CXF).
Is there a java analog to the simplicity of .Net (soap) web service clients? Ideally, you would add the URL to your project, just like you add a service reference in Visual Studio and the behind the scenes code would be setup for you. Is this possible? If not, why not - what is C#.Net doing differently?
I've had good luck with the Spring Framework . Its not quite as easy as C#'s toolset, but when you get down to it, its all just reading a WSDL and generating client adapters. Visual studio lets you do that with the push of a button where with Spring, you can use Ant/Maven to generate your proxies/adapters. Most IDE's will do this for you too (see Randolpho's answer, I know IntelliJ Idea does).
Edit: I believe SoapUI will do this as well, although I haven't used it so I can't tell you how well that works
Eclipse will create a Java web service client very similar to a Service Reference.
http://www.eclipse.org/webtools/jst/components/ws/M3/tutorials/WebServiceClient.html

Run C# File on the internet like a CGI File

I have a Visual C# project on my computer and I would like my users to be able to interact with it through a web browser. I've done my research, and I understand that I will probably use CGI to do this.
However, while I have been able do this with .pl and .cpp files, i can't figure out how to to it with C sharp (.cs) files. Can anyone explain how I would do this?
EDIT: If there is an alternate solution wherein the webpage communicates my C# program as a back-end program, that works, too.
UPDATE: After cancelling with my hosting provider and setting up a home-based web server (windows), I finally got the C# file to run as CGI. Thanks to everyone for your help!
You've got to give us some context ... why wouldn't asp.net be an option? If you simply don't want to run in the context of IIS, you could simply write a windows service (and expose WCF services, or even raw sockets if that's what you need).
edit: in response to the recent comment about the server being UNIX, you can use MONO to run .net code on that server: http://www.mono-project.com/Main_Page
You can either use something like mod_mono or if you'd prefer something different, you can look at manos de mono
First, I assume you have the Mono project compiler and runtime environment installed on your system.
CGI takes place entirely via standard input and standard output. (This is one reason why it is so easy to write CGI scripts in Perl, Python, Ruby, etc. You just start reading standard input as usual, parse the variables, and write whatever output you want the client to see.) Don't forget that you're responsible for the entire header, including Mime type.
If you need something that performs faster than CGI's constant fork(2)+execve(2) re-starting your CLR over and over again, you can implement the FastCGI protocol (at least, I didn't see a C# implementation on the Wikipedia page) yourself using sockets and start your CLR once only, so you have some reasonable performance. (I seem to remember Nat being passionate about the Mono process start time being "fast enough" to use it for interactive commands, so perhaps a lightly-loaded server won't have any trouble with plain old CGI interface.)

Web developer moving to Winforms

I have been doing ASP.NET / C# development for several years now. I have recently been offered a project that will need to be a winforms application (I am assuming .net 2.0).
Specs:
Winforms applicaton
Application will
have "testing for understanding
questions"
Must support flash and camtasia
files (these are "lessons")
I have done winforms development before, although nothing that is this involved. As there is a potential need for this application to be generic enough to apply to multiple different "disciplines", I would like to make the application generic enough to be easily configurable. The caveat here is that the application will need to be run from a CD-ROM and that I cannot rely explicitly on an internet connection. I was thinking of using something like SQL-Lite to support the configuration of the application. There will not be the need for updating the application as it will not be updated (at least I don't think, I guess there is the possibility of the application calling a webservice and configuring its-self based upon returned values).
With the requirements of supporting Flash and Camtasia, along with making this application generic enough to support different "disciplines", and my self being an ASP.NET developer, does anyone have an recommendations or tips/ tricks to look out for? Has anyone done something like this before?
Thanks in advance.
I'd start by writing a user control that can be used to either display a video file (presumably the output from Camtasia) or a Shockwave app. Once you have that user control, I'd then move on to look at the overall app.
If you're using Winforms, and the software is supposed to run from the CD (instead of merely be installed from CD) you'll need to have the DotNet framework already on the computer I think - but then I'm not an expert in deployment.
I find the application model in Winforms to be a lot easier than WebForms, but then I was "raised" in thick clients, so I suppose I would.
I would also, whilst agreeing to WinForms if needs really must, encourage the client to give consideration to using WPF instead - which opens up the idea that you could also provide access over the web using a simlar interface using Silverlight...
Just a few thoughts anyway - good luck with it...

Categories