Hello I am new to web services using WCF,how can I read files stored in a local directory inside my WCF application, I want to be able to read files inside my service application into my client application
I do not want to download files but view them In my client web application, I tried using HttpContext.Current.Server.MapPath(path) but my client website states directory not found since it is looking on local directory of the website
Thank you.
reading file in WCF service is just like other projects.
you can use File.ReadAllBytes or File.OpenRead.
note: you have to set appropriate permissions.
Related
I have a folder on Amazon Web services and I want to transfer it to ASP.NET Server.
The Folder has huge size and I have a limited internet capacity so I can't download it and re-upload it via ASP.NET Web Forms.
so is it possible ? and How could I do it ? or What I should search for this ?
P.S: as I searched all I found was the other way around and I didn't quite understand it.
If you have folder on EC2 you can do scp [unix command to copy files from Linux to linux]
if you have it on S3; you can expose it as public folder; and then on Azure you can download it using wget/curl
I found a service that do the exact thing I want via FTP.
As the user registers two FTPs and he can copy/migraine the files/folders you want from one to the other.
Multcloud: Manage, migrate, transfer, copy, and move files between any cloud storage services.
I have ASP.NET app
I host it on Azure using Web App Service
I have uploads folder where I write videos.
Videos writes well, but when I try to read it and display on View I have this error
The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.
I think error in permissions.
I connect to website using IIS Manager
But I don't understood how get read/write property to uploads folder.
Here is my website structure
How I can set permissions on Web App Services?
I have been struggling to find some resources that help explain, how we use the File Storage with Web App Service.
There are ways to use it with the old Web Roles, Check here (Using the Azure File Service in your Cloud Services (Web and Worker Roles)).
However, there is NO OnStart() methods in "Azure Web Service".
If you're looking for mapping a drive to your Azure File Service share in your Web App using SMB protocol, then I don't think you can do as of today.
What you could do is make use of Azure File Service REST API and manipulate shares and files that way. You don't have to actually use the REST API per se; you can simply use the latest version of .Net Storage Client library which is a wrapper over REST API.
Please see this link for more details on how to use this using Storage Client library: https://azure.microsoft.com/en-in/documentation/articles/storage-dotnet-how-to-use-files/.
Yes, you can. In Linux Web Apps and Windows Containers Web Apps only.
In the Web App, under Application Settings you will find Mount storage (Preview) section where you can mount Storage account. Works like a charm.
Does anyone knows how to do directory browsing using WCF and app.config file.
I tried doing
<system.webServer><directoryBrowse enabled="true"/></system.webServer>
but it did not helped. I need to make one directory within my Server available for users to download their files and I am implementing self hosted WCF services. I can share the files using IIS but it would be good if I can do it from WCF alone.
Directory browsing is a feature in IIS. IIS makes it available; when you use WCF self hosting, you don't have all of those options unfortunately. But it's possible to make a folder in your self-hosted folder structure a virtual directory in IIS so that they can get it there instead, if a hybrid is an option.
A possible way to achieve that is to also self host Katana.
I have a website and web api which made on .net platform.
Web api has a ImageUpload(...) method. I get images as base64 encoded string and saving after turning into byte[].
Here is the story:
Web api's root folder located at: domain.com/API and website's: domain.com/httpdocs.
I hold uploaded images in httpdocs/files/images folder. So it's different folder than web api's. Therefore I am not able to save images in httpdocs/files/images folder. Because web api's context's top folder is httpdocs/API. I can't access httpdocs/ folder.
Any idea how to achieve that?
Try using Server.MapPath to get the server side path.