Shares files folder between two web servers - c#

I am implementing a C# (.NET) application in which user can upload files and images due to huge size (more than 80 gb) we are storing these files on file system now I am preparing a another web server which need to access those files.
My question is How can I access files from IIS from another server, both servers are on same network sharing folder does not solve problem for me
I read about using virtual folder but I have concern will it put extra load on IIS for handling user requests ?
Thanks in advance

If it's on the same network, just access it via a network share. Using a virtual directory can be helpful, if for example you'd like to change the network location without having to change any code that references the location. The virtual directory itself won't put any extra strain on the IIS.
Local network speed will be your only bottleneck compared to files stored on the same machine as the IIS as far as I can tell, since you will be transferring the files first on your local network from one machine to the IIS machine, and then to the end user.

Related

Accessing a VFS shared network Drive through ASP Website and Viewing the files inside, Possible IIS fault

I have an ASP.NET website, that has to access a shared network drive. The shared network drive is on an EMC path or ECS. The management module for the shared drives is EMC made, accessible through a browser, so I am assuming.
In the web.config, I have the drive names as Z:, R: etc..
I am able to mount them on the cmd line with the following line. Otherwise, there is no windows access to VFS folder through the address bar or a browser.
mount -o xx.xx.xx.xx://vfs/folder_I_need_to_Access_to. Z:
I have modified the program's code, mounted the drives and am able to access the files while debugging the code, in the web browser. However, once I publish my code to the IIS server, the code does not seem to access the files and view them, even though the drive is mounted as a network drive and accessible through windows explorer. I have checked permissions on both EMC manager, Windows and IIS.
Some of my distant colleagues have said their teams ran into such issues and fixed them, however they have no idea what to do since they do not usually have logs or bugfixing documents, so I am assuming, mine is not an isolated case.
If you need more info on the subject, feel free to ask, I have scoured the internet and applied every solution by the way. Like NekoDrive, network utility libraries, among other questions on StackOverflow.
EDIT : adding the network folders to IIS as virtual directories does not work as well, however, I am able to access the files and folders through IIS manager content view, so I assume IIS is able to scan the directories and has appropriate permissions to the folders. Also, the user running the website is a domain admin and able to access directories as well.
tldr; The program deployed on IIS cant access the network shared folders under a vfs directory, while its owner and the debugged code on localhost is able to.
I have finally solved the issue.
In case anyone else stumbles here,
Since mounting the drives was impossible, I have modified the web.config to have the IP address instead of the mounted drive's letter in IIS manager, Configuration Editor.
So instead of Z:\ , K:\ or F:\
now it says;
\\XX.XX.XX.XX\VFS\SHARED_FOLDER
and the download link is generated as follows, take note of the backslash and slashes
\\XX.XX.XX.XX\VFS\SHARED_FOLDER\file_path/file_path/file_name
Because it would clearly show the IP of the machine while the download link is hovered on, I am encrypting and decrypting the link variable during runtime.

Microsoft Azure App Service Storage

I have a doubt for purchase a microsoft azure app service to host my app. I have already tested the free profile and i am concerned to switch to a basic profile.
That's my question.
I have seen on this table on azure website here which i'll have 10GB of disk space for my application files.
When i went on price calculator i see this
Well my question is:
Why here i see 10GB of temporary storage? will i lose my application files located in the wwwroot folder anytime?
will i lose my application files located in the wwwroot folder anytime?
It will not be lost if you application files located in the wwwroot folder.We could get the answer from the document.
Persisted files
This is what you can view as your web site's files. They follow a structure described here. They are rooted in d:\home, which can also be found using the %HOME% environment variable.
These files are persistent, meaning that you can rely on them staying there until you do something to change them. Also, they are shared between all instances of your site (when you scale it up to multiple instances). Internally, the way this works is that they are stored in Azure Storage instead of living on the local file system.
Free and Shared sites get 1GB of space, Basic sites get 10GB, and Standard sites get 50GB
Temporary files
A number of common Windows locations are using temporary storage on the local machine. For instance
%APPDATA% points to something like D:\local\AppData.
%TMP% goes to D:\local\Temp.
Unlike Persisted files, these files are not shared among site instances. Also, you cannot rely on them staying there. For instance, if you restart a web app, you'll find that all of these folders get reset to their original state.
For Free, Shared and Consumption (Functions) sites, there is a 500MB limit for all these locations together (i.e. not per-folder). For Standard and Basic sites, the limit is very high (over 100GB).
We could check the application files in the D:\home\site\wwwroot from the Azure kudu tool(https://yoursite.scm.azurewebsites.net/).
Available disk space is shown on the Environment page:

Is there any idea to copy file to another windows server without share folder

In my application,I have to copy a whole directory to the specified location in remote servers, and now we first make the location in the remote servers shared,then copy it.
Furthermore,the location in the remote servers are all mapped to web site in iis. That's to say,each location is a web site root path in remote server,and directories copied to the server will be made as `application(vitrual directory) and deployed.
However,our clients wonder if this is security since the root of the web site location is shared?
So I wonder if there is any way we can copy files without share folder?
Check out WMI # http://msdn.microsoft.com/en-us/library/windows/desktop/aa394594(v=vs.85).aspx
You could probably create a simple Wcf Service which could be hosted by the iis on the target server and give an opportunity to upload files. I guess the security issues (authentication, ip filtering, etc.) can be considered easily enough and the permissions to write files to the server will be necessary only for the wcf service, executing locally.

.NET MVC Websites - shared folders between websites

I have a production website that sits on two servers that used local label files to drive their page labels (request going round robin between the two).
Users need the ability to upload new labels files, but once uploaded on one I need it also updated on the second website - this needs to be immediate. I was trying to use a shared folder on one of the servers, but even if I give it everyone full access i get the error "Exception message: Unable to find label folder at \\MACHINENAME\LabelFiles" when reading from the other server, I've also tried giving full permissions to "IIS AppPool\DefaultAppPool", but get the same issue.
I'm using IIS 7.5 on Windows Server 2008 R2
Question-
Is there a way to share a folder between the two sites?
Is there a better alternative solution?
Thanks
Both the websites should have a virtual folder pointing to the same physical folder, where the users can upload files.
Make sure also that the Anonymous access is disabled
One approach is to map the folder as a drive on each of the production machines, it should then be as simple as refereing to that particular drive letter.
This can be done by navigating to the folder in windows explorer, then clicking Map Network Drive.
I cannot guarantee this will work, buut it might be worth a go.
The IIS AppPool\DefaultAppPool user is a special account that is only local to the machine where it is being used. You cannot access network file shares with that account. You will either need to use the 'Network Service' account or a domain account as the app pool user.
Also, since you are load balancing this site between two servers, you might want to consider using some type of SAN or NAS storage that is shared between the two servers. Otherwise, you will need to come up with some kind of process to synchronize the file share on both servers.

Building, and Publishing, and User-Data (oh my!)

What is the best way to update a "Web-Application" ("re-publish" from dev server to live server) while preserving user-data (such as images, videos, and audio stored in the filesystem) in a VS 2010 build/publish setup?
Additionally, what is the best way to minimize site downtime during these updates?
My backstory:
Usually I "build/publish" the site to a folder on my dev machine, ftp:// into the live server, then drag-and-drop the new "published" files and folders to the live site while making sure not to overwrite any user-generated directories.
Obviously this method comes from my static-html days where it didn't matter. And obviously this is dangerous, flawed, and counter-productive for any Web Application with user-generated data in the FS.
The easiest way is to have a directory that's outside of your code folder where you store the user data. You can even map this folder as a virtual folder in IIS when you need this folder to be available from the internet. Like:
C:\Inetpub
\ProjectWebsite
\ProjectFiles

Categories

Resources