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

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

Related

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

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.

dnx holding locks on files IIS - unable to copy over

We have an ASPNet5 site (angular site and webapi service) running under IIS 8.5 successfully. The issue we have now run into is dnx holding locks on files that prevent us from re-deploying the site from our automated deployment server. The task is simply using robocopy to perform the task but I can reproduce with a simple copy as well. Essentially, the error is "process cannot access the file xxxx because it is being used". The files in question are mostly under the approot/packages dir.
The question is how to work around this. The main goal being able to re-deploy without having to bring down the site which seems impractical.
We are running on Win2012R2, IIS8.5 and clr rc1-update1.
Thanks for your help in advance.

PhantomJS in Azure WebJob? [duplicate]

I have deployed an asp.net mvc website in azure and I am trying to deploy phantomJS as a web job to support the web site.
I have uploaded a zip file with all the necessary dependencies to run PhantomJS and the web job starts successfully after running my batch file. The log reports that the server is up and running # 127.0.0.1:8080. However when I try to hit the PhantomJS app at url 127.0.0.1:8080 from my azure site hosted under someProject.azurewebsites.net it just times out with no other error message.
Specifically I am trying to deploy a phantomJS application that hosts a web endpoint (https://github.com/thelgevold/PhantomSnapshot) that will enable me to convert web pages to pdf if I pass a url from the website to the phantomJS process.
The website will pass a url to PhantomJS that will respond back with a pdf file that can be downloaded. I already have it working outside of Azure, but was curious if the PhantomJS process can be hosted as a web job
Does anyone know if it is possible to deploy PhantomJS in this manner?
I am running my site under the "free" configuration.
PhantomJS is not working on azure Webjobs.
I tried to execute it through CMD shell [yoursite].scm.azurewebsites.net/DebugConsole , but it hanges when I call it with raserize.js script.
you can use phantomjs as worker role, it will work.
Update
Regarding to this:
https://stackoverflow.com/a/23000040/3080500
phantomJS uses GDI to render images and pdf, and GDI is blocked in Azure Website
ref : GDI is not enabled in azure webisites http://social.msdn.microsoft.com/Forums/windowsazure/en-US/b4a6eb43-0013-435f-9d11-00ee26a8d017/report-viewer-error-on-export-pdf-or-excel-from-azure-web-sites
ref : PhantomJS uses GDI for rendering fonts : https://github.com/ariya/phantomjs/blob/6a01a8dece0c4dd697eaa0b208057d2bd43a30f3/src/qt/mkspecs/win32-msvc2003/qmake.conf#L63
We have the same issue with WSAS (Windows Azure Web Sites). We can run can communicate via stdin/stdout with phantomjs.exe, but when ever it does an actual network request, it will time out, or will freeze if a timeout is not set.
Some other applications can make network requests (f.e. curl.exe), but if you try running "ping", it will respond with "Unable to contact IP driver. General failure." googling which tells that there's likely a Hyper-V misconfiguration on their virtual servers.
Azure Websites will not allow you to listen on ports, also you cannot use localhost from within your Azure Website.

Automatically sync to a web server?

I have a web server with websites on it and I was just wondering if there is anyway of me being able to develop the websites on my Linux (Ubuntu) desktop PC and whenever I hit save it uploads it to the web server?
I hope you understand what I am trying to do.
Thanks
Yes, you can do this, using an advanced IDE.
For example a free and powerful one is NetBeans.
Essentially you need an FTP server on your host machine, then in NB you need to create a new project from external source, set up your FTP connection and that's about it, now every time you hit that ctrl+s, changes will be saved on your server as well.
What you're asking about is called continuous delivery. Jenkins is a popular tool that can automatically test and deploy anything you save (or commit to svn or git).

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