Running an executable under Scheduled Task with web access - c#

I'm looking to find out if there are any inherent restrictions when running an executable from a scheduled task that calls a web service while there are no users logged on?
I can't see any inhernt issue if the user that the taski runs under has the correct permissions but would there be any issues connecting over port 80 to a web service?
Thanks in advance.

If any authentication is required for either a web proxy, the web service, or anything else, you'll need to store the password.
You will find a bit of an overview at https://blogs.technet.microsoft.com/askperf/2015/02/18/help-my-scheduled-task-does-not-run/ that covers this.

Related

Application or Service to do some tasks in specific time slot

I've scenario to create an application(Windows service , Winforms app) which runs twice every day automatically on users PC. These Users are internal employees in the same network. So at morning and evening this application has to run. But it doesn't need to show any window or information saying its running. Its good to have a simple notification in system tray that its started execution.
My experience in with web application development. So I got a little stucked with these such application on deciding which is best.What my understandings are if its a standalone exe, we could ask all users to download the exe and install.
If its a windows service we may depend up on instalutil to install the service.
So I really needs an advice on this. The application is nothing, just requesting a TFS api and the resulting JSON has to store in Table. So the JSOn will be based on each user using their windows authentication.
Please suggest a good solution to achieve its the best,secure and easiest way even for non tech savvy users.
Instead of all user communicating to TFS server twice a day i guess better way is to install a service in one centralized machine which will run a window service twice a day and that machine will host that service using WCF so that other user will communicate with machine this will help you to distribute the load of tfs api. i used the same approach in my case where one machine talk to ALM and other talk to that machine to get the files.
Creating a window service is pretty simple and straight forward.
Follow the link to make one:
https://www.c-sharpcorner.com/UploadFile/naresh.avari/develop-and-install-a-windows-service-in-C-Sharp/
You can host the service in WCF using IIS, TCP, Webservice, Console application its upto you. Follow this link
https://www.codeproject.com/Articles/550796/A-Beginners-Tutorial-on-How-to-Host-a-WCF-Service
I guess i helped you :)

OWIN OAuth invalid grant error in Windows Service vs. Console App

I have a Web API using OWIN for OAuth, running in Katana/TopShelf.
When I install the Web API as a Windows Service, everything responds correctly, except a POST via resource owner flow (grant_type=password, username=x, password=y) returns 400 Bad Request (invalid_grant).
The exact same Web API, running in the same folder, except this time running in Command Line mode, using the exact same request from the same remote address, is successful.
The only delta is whether I run the .exe file directly in Console mode or I install and start it as a Windows Service.
I have to think this is a conflict at the network level but Windows Service is just acting as a thin host around the same HttpListener based host.
Whenever we see an issue like this with Topshelf it is almost always permission related. There's some resource that you have rights to but the service user doesn't. Are there resources on disk the service accesses or something similar?

IIS Access Issue

WCF Service
I am developing a WCF Service and it needs to communicate with a com application running on the system.
I have tested the service with ASP.net development server it works fine. now when i run it from IIS the service can't communicate with the com application.
Issue is IIS runs in a different user account 'Application pool', than the one user is logged in. The COM file run on the user account user is logged in. So the that is the reason they have issue communication. Or at least that what i think.
What i did was i created a new application pool in IIS and in advance setting i changed the process model identity to local system. but it did not work....
i need ideas how to make the make the com and the service to run in the same account.
Any idea will be much appropriated.
IIS not only runs under a separate account, but also runs under a separate login session that is completely separated from the interactive users session. The COM object must be possible to invoke without a user even being logged on if you are to use from IIS.

Start a process as a specific user, from a WCF managed service running as LocalSystem

Is it possible to spawn a process on a remote server, from a WCF service hosted as Windows Managed Service, when the service is running as LocalSystem?
I need people to be able to execute things on remote servers under the context of their own accounts (basically like PSExec - which isn't an option).
I've made some half-hearted attempts to do this before, but when using process.start, cannot get the process to run as a specific user, if the Windows service hosting the WCF component is running as LocalSystem.
I know this can be acheived by other methods, but I specifically would like to know if the above is achievable - Windows service running as LocalSystem & hosting WCF service, then spawning a process as a specified user.
Thanks
Mick
You could use the Process.Start method which allows you to specify the user under which the process will run.

Computer A can reach network web service, while computer B can't. Any ideas?

You'll have to pardon me as I wasn't sure where to place this. This overlaps in the areas of C# Web Services and Network/Security management I suppose.
I have a server that runs various web applications. One of them is a web service. The account everything runs under is a local account on the machine. It is not a domain account. I don't know why this was done how it was, but it's one of those things that's just the way is because it's the way it was done.
Super, huh?
Okay so my domain account name is given full permissions on the web serivce. Now, while the account the web service runs under is not a domain account, the machine is on our domain and in our network. So, from my computer, I can fire up a browser and type in the url to the web service in this fashion:
http://serverhere:porthere/servicename
Now the fun part. From a different machine on the same network and logged in my domain account, I cannot load the web service.
Here is the really, really nutty part. From both machines A and B, I cannot ping the server hosting the web service. Might be because pinging is turned off.
So the million dollar question is, does any one have any idea's at all as to why computer B cannot access the web service while computer A (my machine) can?
The server hosting the web service is running windows 2000. My machine is running windows xp. The machine that cannot load the web service is running Windows 2003 SP 2.
Check to make sure the subnet masks for both machines are the same; if one subnet is more restrictive than the other, it'll basically ignore messages from that machine.
There are too many options for this. And I would not bet on account permission issue. You should check the communication with network sniffer, like wireshark or network monitor. Check proxy settings. and post more information about the error you receive.
Silly suggestion, but did you check the firewall settings on the 2003 machine?

Categories