Is it possible to run ATL service as user application - c++

I have to develop ATL app that is meant to run as service most the time, however we need to deploy it as user application in few environments

I believe that the answer is no, but I could easily be wrong - in either case however this probably isn't the approach I would take. Personally in your situation I would either:
Develop 2 apps, a service and a user application, or
Develop a console application and use the Windows Server 2003 resource kit to run it as a service.
See here for instructions on how to run any Application as a Windows service (I'm sure there are better guides out there, but I'm struggling to find them at the moment)

Related

How to publish web service on a website

I know how to create a web service in C++ Builder/Delphi. But, I don't know how to publish it on my web site. I'm using a web hosting service, not my own personal web server. For example,
I usually use the first option "Stand-alone VCL application". Can this one be published on the web site? What are the differences between those types anyway?
Standalone VCL and console applications are mainly for debugging purposes. You use them when you develop your service because this way it is much faster. You can debug your code and use the WebApp debugger that comes with delphi.
If you want to deploy in production use either ISAPI or CGI. ISAPI is a dll that gets loaded by Apache or IIS (most common but there are other web servers that support it). Usually it was faster then CGI because it loaded once and ran inside the host process, the web server itself, but because it is a DLL that meant that if crashed, it could bring down the whole web server.
CGI on the other hand is a standalone executable. It was used a lot on linux where forking a process is cheap and fast. Every request used its own instance of CGI executable. But since then, projects like fast CGI and others made this a lot faster and more appealing. This also goes for ISAPI. Since then, there are ways to isolate ISAPIs into its own sandboxed processes.
As for hosting. Both are 32 or 64 bit Windows processes. So you need a Windows platform to run them. Mostly that will be Apache or IIS. This is not the best option for hosting because hosting is mostly done on Linux. This is the reason why PHP is still so popular. It runs on Linux and 99% hosting environments support it. So if your hosting is not Windows based and does not support CGI or ISAPI then you are out of luck.

WAMP servers... why just for web development

What is to stop you using a WAMP server (or similar) to run single-user business database applications day-to-day?
I read everywhere that WAMP and the like are intended for the development of web apps, but why can't they be used to deploy desktop apps - what're the downsides?
Personally I think WAMP/MAMP/LAMP are great applications that CAN be used for production servers.
I have started doing this myself as I do not have the complete knowledge in server administration on the linux end and my PHP applications are not compatible with IIS.
If you are a small operation than it should save you time then go for it.
If your business grows and you can afford to put on staff to manage dedicated servers with the Apache, PHP ect all installed separately then I also recommend this.
The main difference I can see is that WAMP probably wont be as scalable as the preferred setup. The binaries are all integrated and sometimes I have had issues trying to figure out which php.ini file the system is using.
WAMP is just as secure as any other server as long as you know how to do so, is provides a UI layer which cost CPU time but like I said if you are only serving small web sites/apps than this should be just fine.
My other recommendation is to install it on a Server (Windows 2008 RS or 20012) Windows servers are more reliable and powerful than the Windows User version. Just remember to turn off IIS and any other roles not used by the Windows Server.
Make sure you your WAMP folder backed up regularly!
Good luck
I haven't found one yet. I guess the speed won't be as good as a 'pure' setup, but it sounds like that isn't an issue.
I run an epos web app for a photo studio no problem at all!
WAMP usually stands for Windows, Apache, Mysql, PHP or whatever your particular choice for P is. It describes a stack meant for specifically for deploying/developing web applications and is a rough equivalent to LAMP. Most things that would be considered desktop applications wouldn't use a webserver and more than likely would not be written in PHP.
The issue is not so much one of downsides as it is Apples and Oranges: Desktop applications are usually built with a less web centric stack.
Actually i used with wamp for many purposes; I used it with VB.NET apps, PHP, etc...but I think if you want to use it for deployment, you should start by configuring it to do so.
For example, for PHP deactivation errors display in php.ini, start listening on all allow all in httpd.conf, activating safe mode, setting a password for MySQL; and many other options that have to be configured.
I personally prefer because it is a quick and lightweight tool.

Host a c++ desktop application on a webpage

I am having a desktop application which having a UI interface made in Qt linked with a library which is doing all the calculation stuff. Values from UI is taken and pass to the API's in the DLL to get the output which is shown on Screen.
Now i want to do the same thing by transferring my application UI to a web page so that people can access the tool from anywhere without any installation process.
I want to retain my c++ DLL code so i don't have to do a lot of work. I am thinking of just converting this DLL to a C++ server by any communication Process(Sockets). I want to host this application on my company's website. (We have to make the website also so we are open to any set of tools).
I want to know what will be the best set of tools to do this stuff. Also there will be lot of data exchange between the webpage and server so the wholething should be optimized also. I goggled a bit and find stuff like silverlight and ASP.NET, But i am still not very clear which option will be more suitable.
I am a c++ programmer with no web application development experience. I am open to learn any new technology.
Thanks
Why not use Qt on the web directly? There are several projects like this one: http://qtwui.sourceforge.net/
There is a netscape plugin that will host a QT application and an ActiveX control wrapper on the QT website. You could use one of those to wrap your application. Note that this approach would require the user (or their administrator) to download and install the plugin.
An alternative approach might be to run your application through a remote desktop such as XVNC, NX or an RDP based layer. IIRC browser based remote desktop clients are available for most such protocols.
A few options:
pick a messaging/queue implementation (like http://www.zeromq.org/) and provide a service
implement a Windows Web Service if you want to be more enterprise friendly: http://msdn.microsoft.com/en-us/magazine/ee335693.aspx
I would not expose the implementation on the internet. Enough to have a simple buffer overflow and the machine can be taken over quickly. Adding a layer between the app and the web provides an easy way to validate input, access, stats ...
You should be able to use your DLL from an wt or cppcms application. Then you do not have to learn something new and can just use C++.
The way I'm currently doing this is with Boost.Python + django

Building web services without a web server

OK, this is impossible, but I will try to explain the situation here.
Let's say we have cases, that we need a fast setup of a web server in order to have a simple soap web service running (querying a db and so on).
In VS though, upon debugging a web project, it creates a quick ASP.NET development server without relying on the actuall IIS that might be installed on the PC.
Is there any project that does something like that?
This would be ideal for small projects, where a simple executable would get a server ready to go and would allow web services to be executed right away.
I have looked at some stuff over the net like http://msdn.microsoft.com/en-us/magazine/cc163879.aspx and http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/2004/05/24/4479.aspx but they seem to be quite outdated and i am not sure how well they work (havent tested them thoroughly)
EDIT: I have build an application like the one you suggest. However, how can i implement HTTP GET/POST requests to the service using this method? I tried using WebGet after my operationcontract but it didnt work. For example, my service is at http://localhost:8080/Service and i would like to use it such as http://localhost:8080/Service/getMethod?x=2.
I believe that the development server used by Visual Studio is based off of the Cassini code base (of which there is a fork here). I also found this article on hosting the asp.net runtime. It was also created a while back (2004), but has been updated since (2008). I think a lot of the core concepts are probably still the same.
Another approach would be a roll-your-own web server using the HttpListener class. This could take some work if you want to use it for hosting asmx type services, but if you were doing RESTful services, it isn't too bad of an option (this is actually how RavenDB works if you are not hosting it under IIS).
A WCF service can be hosted in almost any kind of application, including a Windows Service or a console application. There is no need for a web server at all.
Alright,
i've done it so im posting it here to help anyone who has issues with similar problems.
Create your WCF Service file as usual and then by using ServiceHost (or WebServiceHost) you can easily create a WCF service.
In order to use GET http requests to make it simple to communicate with mobile devices (such as iphone) you can use WebGet above your service methods and make sure you manually add a service endpoint using WebHttpBinding for WebServiceHost or WebHttpBinding with an WebHttpBehavior for ServiceHost.
Then you can call your service methods such as http://localhost:port/webhttpendpointaddress/mymethod?x=2.

Deploy .asmx (not WCF) web service on windows 7

I need to deploy an old style .asmx asp.net web service (not WCF) on a windows 7 machine for test reasons. However it seems that just deploying it on a virtual directory or new web site on IIS won't cut like it used to back in xp.
What should I do? I need to test the service locally prior to deploying it, and so far it's giving me a hard time.
Any help will be greatly appreciated
Thanks
Deploying to a Virtual Directory should work just like it did in XP...with one minor change.
The default behavior in IIS7 is to use 'Integrated' Managed Pipeline Mode for your Application Pools. More than likely, you just need to change that to 'Classic' Managed Pipeline Mode (or switch your Web Service over to use the built-in 'Classic ASP.NET' App Pool).