Creating symbolic links for IIS7 web environments - asp.net

. .
We have a growing need where web resources (files, documents, images, etc.) need to be shared between different web environments.
I'm looking into setting up symlinks to support this, but I don't know how to set it up. (Or would it be better to set up virtual directories? Part of my question is, what are current best practices to set this up?)
For example purposes, assume:
The environment is running on an IIS7 platform, and MUST be in a Windows environment.
The shared files need to be maintained using TFS.
The web sites occupy different sites on the same IIS instance and reside on the same physical server.
The sites are multple web platforms -- for example, one site is ASP.NET, while another is running classic ASP.
All sites are under the same corporate umbrella, which is why resources need to be shared.
All sites pull data from the same SQL Server database instance.
How would I set up a symlink to support this? Or, for that matter, are symlinks the best way to go about this?
Thanks in advance!
Edit: Addendum to the above example: my classic ASP environment can also include ASP.NET virtual subfolders. For example, I can have my domain www.somedomain.com running in classic ASP, but have a subdirectory (www.somedomain.com/dotnetapp) running as an ASP.NET application. The virtual directory used by the ASP.NET must be able to access the same file resources as the classic ASP environment.

On Windows virtual directories are more the standard way to do this. It also allows you to use IIS' virtual directory features and Windows/IIS rights management.

Related

Where to deploy complex .NET applications which include web and non web component

There doesn't seem to be an obvious place or any documentation from Microsoft that explains where to install complex applications which write files into the app folder and are shared by different users.
We have a complex .NET web application that contains 21 individual projects and includes the following components:
A main web site which runs a SAAS system and can be locally installed at customer sites
Applications to install, configure and diagnose
Applications which are installed as windows services
Utility applications which are installed on the server and can also be installed on clients and talk to the web app through web services
On Windows 2012 and earlier, you could quite happily deploy this application into program files, and the entire app would sit in one folder. All fine.
However from Windows 2012 R2 and later, normal user accounts cannot write to program files. Our web app contains significant uploading ability, not only of occasional use files, but also a high volume of data files which are fed from customer LANs to our SAAS system. In addition there is log file writing, and session files etc are written inside the folder that hosts the IIS web itself (edit: and the webfolder itself also exists inside our program files app folder)
From what I can gather, apps now reside in program files, and common data exists somewhere inside c:\users\public, and user specific data exists inside c:\users\username. That means the app is spread around on the hard disk and not easy to backup or administer. To follow those conventions we'd need significant rewriting as a lot of the EXE's write relative to the exe path and the web backend also relies on being able to write files inside the webfolder itself.
So is there a proper place in Windows where a complex app like this can be installed that writes to its own folder structures ?
I've noticed on Windows 2012 R2 and Windows 2016, that I CAN create a folder in the root of C: drive, whereas on Windows 10 I cannot. Would a standalone folder be the right solution to this ? It would certainly be the easiest solution for us.
The windows services and IIS app pool would always run under different credentials, so they could no longer share settings if we have a per-user model for writing files.
The app will have to conform to DoD STIG standards for web and .net applications.
thanks

IIS Multi-Site using same code base

I setup a Kentico CMS to host multiple sites and I'd like to know if it would be a good practice to setup multiple website in IIS using the same code base? I'm using IIS 8 on Windows 2012 R2
Chel,
I don't think having multiple IIS applications point to a single codebase is a good idea. Kentico will add/update/delete several files within your application folder as part of it's normal processing. Having multiple IIS applications performing this action on the same folder on the file system will introduce complications and errors due to file permissions and access rights.
You could set up your solution a few ways, depending on how you wanted to manage your applications.
Single IIS application / Host Headers
In this scenario, you would have a single IIS application / folder. All sites would be delivered from the same codebase. All traffic would be redirected to the same IP. In your IIS configuration, you would use host headers for each URL you wanted to send to your site. In Kentico, you would have a license / domain alias for each site you wanted to server.
PROS
This set up would give you a single codebase to manage your applications. This can simplify a good bit of your maintenance and hot fixing.
CONS
If you have to restart any of your sites for any reason, all of your sites will go down at once.
Separate codebase / IIS application for each site
In this setup, you would replicate your codebase for each site you wanted to deliver. You would create an IIS application for each codebase, configured for the appropriate URL. Each domain would be directed to the appropriate IIS application.
PROS
Can isolate your application. Can provide the ability to use different .NET frameworks / configurations for each app.
CONS
Several codebases to maintain. Updates to all sites require duplication of code across all codebases.
Personally, I would recommend option 1 if all of your sites are on the same .NET framework and it is not critical if they have to be restarted. If any of them are critical LOB applications, you may consider branching that one application off to it's own IIS application pool / codebase.

ASP.NET application to host on Java EE configured directory

One of our clients has a Java EE application. We would like to develop a new project using ASP.NET/C# by hosting the application as a sub directory under this Java EE project.
My questions are:
Will the .NET application run smoothly?
Do I need to keep anything in mind before I make a promise to the client?
The way you strucure your projects do not affect the behavior of your applications at all.
However in the end, each of the compiled and not compiled resources need to be configured propoerly to their proper Web Server, you shouldn't have any problem at all.
IIS has its own directory and Tomcat(or whatever you are using) will have its own directory.
Just let him understand that there is no sense on sharing the projects in a single root folder if the projects are not going to be related at all.
The only way to make them interact is by means of services and queues that you can orchestrate in any of both technologies.
UPDATE
let's suppose that:
you are using default of both web servers: your IIS need your applications to be copied to c:\inetpub folder whereas tomcat uses the $CATALINA_BASE system variable to locate their own folder. That won't be a problem at all.
Now, let's suppose that your client chose the same exact folder to be the root of your websites in tomcat and iis, (very bad maintenance decision by the way)
you could also separate both environments by having two folders : JAVA and DOTNET
Now let's suppose your client won't accept any logic suggestion, and you have to merge java files and aspx files, technically there won't be any issue because each web server will handle requests for very different issues, however, if you are also using the same resources, let's say a picture used in both pages, you will have locked-files issues, your iis can only respond for its own behavior and tomcat will only respond with its own behavior.
So in summary, technically speaking it could work, performance will be hit on your hard drive, it all depends on the request loads of each app, but overall it is a bad infrastructure design.
hope it helps,

accessing multiple virtual directories using a single web app

Is it possible to look into multiple virtual directories, using a single web application?
I'm trying to develop a web app; which can create a site, save this site to a virtual directory in the same server, and make changes (i.e. add/edit webpages).
The web app will handle multiple domain names (IIS will handle the bindings going into the single web app), which are routed by the web app to their respective virtual directories.
Can anyone point me to the right direction?
Thanks!
First of all, you need a certain permissions in order to manipulate the IIS metabase. The default ASP.NET user account doesn't have such permissions so you might want to use an impersonation. You can read more here (what is impersonation) and here (how to impersonate programmatically).
To configure the IIS programmatically use the classes from the System.DirectoryServices namespace. You can read more about how to do this here (tagged as for IIS6). You can also use the Microsoft.Web.Administration namespace (which seems more specific to IIS7) but in this case you need to download and install the corresponding SDK.
Hope I clarified things for you a bit.

Multiple Virtual Directories pointed to the same folder on web server

I have a presentation web farm with four load-balanced servers. I have one web application with two website domains that represent that application. Rather than constantly push to two different folder locations, I figured I can push to one location and have a virtual directory on each website point to the single folder on the webserver.
Here is the setup:
The load balancer is CoyotePoint. The web framework is asp.net 3.5. IIS 6 (slowing moving to 7).
I'm concerned about performance in a production environment. Are there any ramifications to having two websites with virtual directories pointing to the same directory on disk? Should I also be worried about application pools?
I think I found what I was looking for. It's called CentralizedWebFarmManagement for IIS. Specifically, I think the Shared-configuration, and Web Deployment Tools for Web Farm is exactly what I need!
It depends on what this application is doing. If you're doing anything at all fancy with System.IO you're going to run into issues.
There are other ways to make the pushing of files easier. I highly recommend creating a quick bat file with a few robocopy commands in it.

Resources