SFTP file upload in WCF service - wcf

Can anyone help me out on how to implement file upload from mobile device to Dotnet service using SFTP process using WCF service or any.

WCF works on HTTP protocol with or without SSL.
SFTP works on SSH protocol with or without SSL.
FTPS works on FTP protocol using SSL.
First make sure what you exactly want to do and which protocol is suitable for your case.
If you are looking to transfer a file using WCF try to use Stream as input type and store it on a physical location on the disk.

Related

Can we create sftp proxy using apache camel?

There is an application that's sending files to sftp server which was implemented by java.
To test that, we need to introduce some delay in transferring files.
Is there any way in apache camel to create a sftp proxy so that my application sends file to camel and camel send to actual sftp server with delay. without breaking any sftp mechanics.
Thanks,
Chinna

file upload to SFTP server from a jsp page

I have a webpage which contains the button to upload a file. My requirement is, when user chooses the file to upload and click the submits it, the file should get transferred to an SFTP server. My question is, do I need a SSH client installed on the client machine for achieving this?
I thought of uploading it to my http server as a temp file first and then to the SFTP server from there, but then what's the purpose of SFTP on the first place as the file will be transmitted to server as unencrypted.
JSP is a server side technology. If JSP is going to be involved, then the code has to run on the server.
My question is, do I need a SSH client installed on the client machine for achieving this?
No. The server has to do the work.
I thought of uploading it to my http server as a temp file first and then to the SFTP server from there
That's how you would have to do it.
There's no way to interact with the SFTP protocols directly from client side code in a webpage.
then to the SFTP server from there, but then what's the purpose of SFTP on the first place
Good question: But you decided to use that technology, so that's up to you.
as the file will be transmitted to server as unencrypted.
To secure communications between the browser and the HTTP server, use HTTPS instead of plain HTTP.

May i open a port on Cloud Foundry?

I want to establish a UDP Connection from a terminal device to My App On Cloud Foundry.
all output from applications on Cloud Foundry is delivered by proxy via a web server (nginx) and as far as I know only http and https are open.
Perhaps you should look at alternative ways of communicating with your console application, what kind of communication are you trying to achieve?
Using the CF_HOST:UDP_PORT from your terminal device should be OK. I suppose that an application (Java, Perl, etc) is deployed on your terminal device and on the CF server an application with a UDP channel is deployed.
This is an old post but i've had a similar problem when porting my app to pivotal's cloud foundry platform.
Turns out you can continue to use tcp or udp for any outgoing traffic without doing any special configuration (e.g. service binding, etc) but only http or https for incoming traffic. However, there is an interesting workaround proposed here

How do I host a wcf service on the internet?

This is probably a basic networking issue, but I am new to this stuff and just do not know the answer.
I have written a wcf service and client. I can use one of the http bindings and get the service to work correctly when I put my machine's network IP address as the endpoint address and run the client and server from the same machine. Now, I want to be able to connect to this service from a different machine over the internet. Clearly it does not work when I use my network IP address in this scenario, but simply putting in my router's broadband IP address does not seem to be doing the trick, either. Am I just missing a firewall port that I need to open up, or am I trying to do something that should not be possible?
If you want users from the internet to be able to connect to your service, you'll have to consider a few points:
binding: the lowest common denominator is the basicHttpBinding which is SOAP 1.1 with basically no additional features available - just like ASMX webservices. Just about anyone can connect to that. For more advanced clients, you might also want to expose a wsHttpBinding endpoint on your service
security: how (if at all) do you want to secure access to your web service? Do you have username/password credentials that callers must supply? Check out the WCF Security Guidance for a whole slew of information bits on the various security scenarios
authenticating your service: typically, you should strive to make your service authenticate itself to the rest of the world - this requires a server certificate and enables secured communication (messages signed + encrypted) on the wire
make sure your service endpoint(s) is reachable from the internet, through all firewalls and proxies and everything :-)
Hope that helps a bit!
You need to set up port forwarding on your router. Perhaps someone on ServerFault or SuperUser would be able to help you. Or even a google search now that you know what it's called. The instructions will be different depending on the router. The port you need to forward will be the port you've picked in the WCF config file.
I host WCF services through IIS, but it took me ages to work out how. At the moment I put the files on the webserver and enable websharing on the root folder. Then you can assign them to an appropriate Application Pool in IIS, and add a service reference to any client projects using the URL of the wsdl.
I'm not sure if this is the best way to do it but its the only way I've worked out so far.
Here's the simple solution.
I am assuming that you have made a working WCF application and hosted over the IIS.
The next thing to do is to browse the application from the IIS. It will give you url in the address bar something like:
http://localhost/myservice/service.svc
Next go to www.whatismyip.com. this will give you your system's WAN IP (say, 45.34.56.200).
Replace the URL you got in step 2 with: http://45.34.56.200/myservice/service.svc
Now you can use this URL any where in this world to consume your service.
I found a good Article and it is working fine for me, on the following the Main steps:
1-First you should create WCF Service.
2-add application on IIS and give alias for your virtual directory and set path from your local drive.
3-Make sure your default app pool set to .NET CLR V4.0.
4-test your WCF service is running successfully on localhost.
5-To access the same via LAN (Local Area Network) you must disable Firewall for you Private network.
6- try to use ngrok.com, you will get Temp URL to use via internet to access your LocalHost anywhere.
Then Everything will be fine.
For More Information Check the following Link:
https://www.codeproject.com/Tips/813650/Host-WCF-on-LocalHost-and-access-via-Internet

How would I create a remote admin console for a WCF Service using telnet/raw?

I have a WCF service currently using a TCP endpoint. Rather than create a separate console client app to administer the server I want the ability to telnet into the server or even just connect using a raw connection using putty and execute ascii commands straight on the server.
Any ideas how I would go about doing this? Not an expert on WCF so would appreciate any help. Thanks
I doubt you could do that - WCF will always have to use its defined endpoints - TCP, HTTP - whatever. I am not aware of any telnet binding or raw connection, as you mention it.
From my perspective, why not create a service contract for admin purposes and just hit that with HTTP and/or TCP from a console app? Seems easier than trying to "bolt on" something that's not really been thought of.
Marc
To administer my WCF apps, I host in IIS, and have a subfolder in the application virtual directory with Admin aspx pages. The folder is protected from unauthorized access using ASP.NET roles.
The Admin folder includes application-independent pages (e.g. managing logging, view log files) and where appropriate application-specific pages.
Since the ASP.NET pages execute within the same AppDomain as the hosted WCF services, the sky's the limit as far as adding functionality for instrumentation and dynamic configuration.
I don't think WCF support custom command processing out of box and it will be quite a bit of hoop jumping to get that to work. I would suggest
Host the WCF service inside a windows service rather than IIS
Create a socket listener inside the windows service listening on the port of your choice
Write some code to process your command when data arrives the socket