Hi I have a C# Windows Service installed on a server.
On the other side, the service starts a timer that will read files from a network folder.
My customer requires that a fixed length file is created on a network folder, then they have a process that will do some stuff to the file and in case of success the file is deleted but in case of an error the same file but with extension .err is created.
I know that there are Windows API's that its possible to trigger an event every time a file is created, the thing is that this folder is not on the same server where the service is running.
Is that possible? Mapping the folder into the server will do the trick?
The FileSystemWatcher class in .NET will use the appropriate Windows change notification APIs, and the SMB 2.0 protocol supports change notifications that get delivered via the Windows change notification APIs.
So, if the remote server supports SMB 2.0 (Windows Server 2008 or above, Unix hosts running Samba 3), then the FileSystemWatcher class should do the trick.
Related
Please suggest the best way to I copy data from Azure File storage to local machines every 2 hours (periodically). Can we write a C# exe to do that and deploy it on the PC?
Write a desktop application in any language with the SDK support of Azure File Storage. Within that application, create a timer to do your download through the API.
If the there are configurable settings or user interactions needed, I'd say go for a desktop application.
Otherwise, and if your clients are windows PCs, best way would be to write a windows service that does the job.
You perhaps could use Azure Logic Apps - if you set a job to run periodically and copy files from File Storage to OneDrive, for example, then OneDrive would replicate your files onto a on-premise server.
I'm trying out the free tier on Amazon EC2 and intend to host a couple of small websites through the same micro instance. I have set up and configured an EC2 micro instance running Windows Server 2008, with all the necessities. The websites are all ASP.NET MVC3 applications.
I have installed the AWS Toolkit for Visual Studio and connected to my Amazon account, which all works well. The problem I have is that if I right-click my project in the Solution Explorer and choose Publish to AWS..., the only options I have is to publish it to a new instance. This does not work for me, as I want to host multiple sites on the same server.
Is it possible to publish to an existing instance using AWS Toolkit, and if so, how do I go about doing it?
As far as I understand it the quick answer is no. This is because the recommended process after launching a new instance is to change the local admin password from that set by AWS. Since the publish to cloud formation only has the AccessKey & Secret Access Key it cannot get the new admin password & as a result cannot connect to an existing instance.
The quick way around this would be to set the instance's security group to allow FTP from your public IP address and then just publish via FTP.
I actually use a plugin called "dispatch", which publishes directly from Visual Studio to the server via FTP. I hate FTP, but that's the nicest solution I've seen so far.
I've been looking for an alternative myself.
The only other option I've used is called AllwaysSync, which is extremely cool. It can sync up a local hard drive with an S3 account. You can then link that s3 directory to CloudFront.
I've been "considering" doing a double sync with that, where I have alwayssync installed on my development box, and installed on my EC2 server. The EC2 machine has AlwaysSync set on auto-sync, so any changes to the S3 directory would get sucked in to the EC2 machine. That directory would be synced up with my local development machine when I initiate the upload.
Still.... It seems so half-as_ed that I've just sat back and waited for Amazon. They usually come up with something.
One thing that I've found works EXCEPTIONALLY well (if you have a fast connection)
I actually use an EC2 server as a workstation and RDP as a thin-client. There's an app called "SplitView" that lets me use 3 monitors at my worstation. I click a shortcut to RDP, my 3 monitors flicker and boom, All my stuff is still there from last-night. If someone steals my laptop.... there's nothing on it at all, except a link to the RDP account.
Anyway, now (for the Amazon sites) I just drag my files over to the live machine and change the IIS settings to targeet the new directory.
I've got issues with this task.
I have a client-server application for synchronizing files in certain folders. The local client runs on Windows 7 and server is on Windows server and I need a local desktop application that would check the file changes on the server and to notify these changes. I've played a bit with the FileSystemWatcher class, but it seems to work only on mapped drives or local machines either. It has to be somehing like http://server.com/watched_directory.
Is there another way, how to reach the point?
You're right. FileSystemWatcher just works on local or mapped folders and do not work over http protocol.
Anyways, you can to write an application which uses FileSystemWatcher and run it on your server with a WCF interface to your client on Windows 7 machine can interact with data collected by first application. So, it will be more like a client/server application, but seems to fit your scenario.
Hi
I would like to retrieve documents from an ftp in my Windows phone 7 application (built with XNA in my case).
As far as I understand WP7 does not support ftp due to port and protocol(?) contraints.
Is there any way to get ftp support working?
I guess I will be able to implement it my self once socket support is added but I dopn't wan't to wait for that.
Cheers
/Jimmy
Since there are no supported socket capabilities in the initial release of WinPhone , you cannot directly FTP. You would have to create an "FTP Proxy" web service which your phone would call and have the service do the actual FTP and relay the files.
FTP and Sockets are not supported by the platform at the moment.
If you want to get remote files on to your phone you'll have to use HTTP(S).
You can do this either with the HttpWebRequest or WebClient classes depending on your specific needs.
Do you want to retrieve files fromn the phone, and over the cellular network? If so you need to confirm your operator allows ftp connections to your phone, which they probably do not.
If you're connecting over wifi, you've got more chance of this working.
Otherwise, you could implement a dropbox-style approach where the phone and your file-retrieving application both connect to a remote server
If this is for development purposes, you can get access to the phones storage and copy in files by using Microsoft's SmartDevices API.
I'm trying to do the same but so far the only way I've found around it is to create a web service to run on my own server which retrieves the FTP files on behalf on the phone.
Wish MS would hurry up and give us sockets - calling a web service is fine but I'm pretty sure it would be slower than directly getting the FTP files from the phone itself.
Visual Studio 2008
I have a xml file I want to send to a ubuntu server.
Before I was using the following to save on the current machine in the application folder. However, the customer has changed and now wants to store it on a remote network ubuntu server.
dt.WriteXml(System.IO.Path.Combine(System.Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Config.xml"));
What is the best way to send files across the network? Is it possible to send files from a windows machine to a ubuntu server machine?
Many thanks for any advice,
The easiest solution is probably to use a samba daemon and plain old file copying. If your customer wants to use the Ubuntu server as a file server, they may have already set this up.
Another option is to run an FTP daemon on the server and use the WebClient class to upload the file to it. You can use the WebClient.UploadFile method to upload a file to the server or WebClient.UploadString to upload the string directly, using the FTP STOR command.
The easiest thing to do is probably to SCP it onto the remote machine.
Run a samba daemon on the ubuntu server and you can use shared folders (SMB) to transfer the file.