How to deploy command-line program (exe) on IIS server? - web

I have a classical command-line program (exe), taking some parameters and doing some stuff.
I would like to make it accessible via internet, i.e. via web browser.
I have a Windows server with IIS web server and a running web site.
Is there a way to deploy this exe command-line program directly? Can it be embedded into existing web site? If not, what is the way to proceed?
If yes, how do I pass parameters to the exe program?

As far as I know, .exe cannot be deployed on iis server, because the web applicaion on IIS has to be configured to be able to run executables. if you want to run .exe through IIS, you can try it this way:
Make your web site write a file that indicates the process needs to
be run.
Write a Windows ervice that runs on the web server that watches for the file that your web site creates.

Related

Hosting standalone web app in IIS (directing host name to local runnig web application)

There is a running stand alone web service running in windowserver its address http://localhost:1234, it starts running with double click of service.bat file,
In IIS, I have created a web site with hostname(myhostname) and set apps target folder as same path with service.bat,
and expected browsing from another computer like http://myhostname.com direct to this web app,
of course it doesnt work.. how can I achieve that?
IIS won't actively execute a bat file, unless executed with the help of asp.net applications. And for security reasons, by default iis will block access to the bat file, and you need to set the permissions of the application pool. Not only the bat file, but the exe file is the same. When executing the exe file with the asp.net application, you need to set the file in the folder and add the application pool as the executable.(You can refer to this answer)
If you want to redirect to localhost:1234 by myhostname.com,you can use url rewrite or redirect module ,then enable proxy in arr. This is detail steps.

How to restart a dnx website in production?

I updated a ASP.NET CORE/ASP.NET 5 RC1 controller cs file with a programming change.
The site has previously been deployed on production on IIS7.5 Windows 2012 Server which makes use of HTTPPlatformHandler installed in IIS.
This is a remote server I have to access via VPN.
The site is setup as an application in IIS and the folder points to the wwwroot directory of the deployed site.
I deploy it currently by deploying it first locally by right clicking on my project in Visual Studio 2015 and selecting publish to local folder. I then copy the contents of the local folder to the remote network IIS7.5 web server site folder.
If I copy for example the appsettings.json or a changed .cs file to the server, the change will not reflect.
If I copy the whole site to the production server I get folders and files in use messages. I have to kill the 'dnx' process in order to copy without getting these messages.
From my understanding if I kill the process dnx it will force a recompile. This is currently the only way I know of to restart the site after updating it but I imagine it is not the best way.
What is the standard practice to restart your website after you update your production sites that run ASP.NET5 RC1?
Also changing my app.settings json file aslo doesn't trigger a site reload like changing the web.config did in ASP.NET 4 so being able to restart a site is important.
If I have multiple sites on the same app pool and I only want to update one in production. How can I only restart the one site to reflect the latest changes?
Is it possibly to restart the website to reflect the change as updating it directly doesn't cause a recompile taking into consideration if I only have access to a shared folder and not the web server itself?
With IISPlatformHandler, DNX process is started by IIS (instructions are in wwwroot\web.config).
IIS knows nothing about your source files, all requests are forwarded to DNX.
DNX does NOT watch source files for changes, because there is no dnx-watch there.
IIS only watches for wwwroot\web.config file changes, so you need to change/edit/touch it to force IIS to restart website (and DNX process).
I use msdeploy to deploy, it has commands to stop and start app pools, using these commands has resolved my file in use errors. There are lots of ways to use msdeploy, below is how I happen to be using it.
msdeploy -verb:sync -source:recycleApp -dest:recycleApp="site/pool",recycleMode="StopAppPool",computername=COMPUTERNAME
msdeploy -source:contentPath='SOURCE PATH' -dest:contentPath='\\COMPUTERNAME\wwwroot\' -verb:sync -retryAttempts:2 -disablerule:BackupRule
msdeploy -verb:sync -source:recycleApp -dest:recycleApp="site/pool",recycleMode="StartAppPool",computername=COMPUTERNAME

How do I host a long-running task on a Windows web hosting?

I'm having a smarterasp.net windows web hosting. I need to have a service that runs permanently and periodically parses a specific remote website, writing results to a log file. I have created a windows servcice, but how do I host it on my web hosting? Running exe files is forbidden, as well as SSH.
Any help? Thanks.
As far as I have found out, it's often impossible to run a windows service on a web hosting, like in my case. One of the possible workarounds in hosting a background process in the website process, specifically by utilizing things like hangfire.io

How to run exe under command line by the web service deployed on IIS 8?

I have deployed a web service on IIS 8, the web service need to run some .exe utility tools by using command line console. It works perfectly on localhost, but it does not work when I use web browser to access it remotely. the exe did not get call at all. I did some research on internet, someone mentioned it is IIS user permission problem which I created a new account with full control permission, someone mentioned that is because application pool has different permission with the web service(which I checked it is not the case).Someone said it might because the exe file is 32 bit application so I enabled the 32 bit application run in application pool. However, none of above fixed my problem. I was wondering if I missed anything?Thanks for any help.
some updates, I have also changed the handler mapping on IIS to enable the Execute exe(under edit feature permission). The exe file I need to call is from a third party company. Now I can run system method like "dir .", "ping xx.xx.xx.xx" with now problem, but not this exe file.

can you deploy cruise control .net as a web service/web app?

I'm investigating the possibility of utilizing my web host as a cruise control.net build server. If I have access to MsBuild or can deploy msBuild and run it, it would be great. I can not however find any resources that would tell me if cruise control supports being run as a web service or web app.
Is this type of deployment possible? If not could the UI (it's web-based I believe) control section sit on the web server and send requests to the actual build server?
CruiseControl requires it's own Windows service running in the background. Unless you can install services (not web services, but actual Windows services) on your host (which is unlikely unless you have a dedicated server), or just keep the EXE running until the end of time in debug mode, you won't be able to use CC.Net in this way.
It's better to keep this as part of your dev environment, anyway. You don't want the security risk involved with having that level of control available to anyone that manages to log in to the server.
I figured it out. This was very doable, just copying the web directory from Cc.net's install and editing a few config files.

Resources