Same .NET code files, different web sites/domains in IIS? - asp.net

ASP.NET - IIS 6 - we currently have a public-facing site that has a domain mapped against it. We are going to add a new web site in IIS 6, with its own IP, its own SSL cert, and its own domain name on the same server as the original web site/domain.
Let's say I want c:\inetpub\wwwroot\example to be be served up to the two different sites, where each of the following URLs would load the same .NET code.
https://www.domainA.com/example
https://www.domainB.com
...I'm trying to not splinter my code, but I'm not sure if there are pitfalls with the above approach. Will that work?

Yes. I have had two separate sites / virtual directories pointing to the same physical directory on the server with one set of code.

Related

Sharing web.config fies between sites

Not being a server admin I was wondering, can two ASP.NET websites on the same server sharing a common database use identical web.config files? I am developing a separately-branded companion website for a company with multiple business groups. Both sites have their own URLs but are hosted on the same server and will both communicate with the same database. Since the one site is already setup and running I was hoping I could save time and reuse the web.config in the new site. Will this cause any conflicts with the RSA key and its related cyphervalues?
Thank you in advance.
The answer is NO. Each website must have it's own web.config in the root folder (at a minimum).

web services on a dedicated port within an ASP.net web site

Is it possible to have a web service within an ASP.NET forms web site run on a different port, sort of like how SSL has a dedicated port?
The service needs to see the app_code folder in the existing site and of course app_data.
Any links to articles or tutorials would be greatly appreciated.
You can have several different ports bound to a website in IIS, however if you bind that port, it will work on the whole website. You can't bind a port specifically to a directory within a site.
So you can have a secondary port (ex: 8080) added along with a hostname through the website bindings in IIS.
If you don't want to have the rest of the site (that's not the web service) to respond to the secondary port, you would have to do it through either code, or configuration.

Is it possible to run ASP.NET in IIS 7.5 without creating Virtual Directories or Applications?

I have a Continuous Integration server with dozens of ASP.NET applications hosted on IIS. Everytime I want to deploy a new application, I have to create a new Website or virtual Directory and configure it as an application in IIS.
I would really love to have only one website listening in a specific port (say, 80) serving multiple ASP.NET sites according to wildcard host headers.
For instance:
*.dev.mydomain.int -> my server's ip address (eg: 192.168.1.32)
IIS web site reads the host header and try to find a local folder with the same name. Ex: when a request uses the host header "helloworld.dev.mydomain.int" IIS tries to open a preconfigured folder appending the host header site name (e.g: D:\dev\helloworld)
IIS serves the contents of the folder as an ASP.NET application, using preset configurations (Application Pool, ASP.NET version, and so on).
My goal here is not to create a web site or virtual directory for each and every project in our CI server. I know I can create them programmatically, but I'd prefer a more dynamic solution.
Thanks in advance
You can use MSBuild tasks to create Virtual Directories / Web sites automatically.
http://fczaja.blogspot.com/2009/02/automatic-deployment-of-webapp-on-iis.html
I had it working on a large application with many branches (we had an environment for each branch) and I didn't have to open IIS settings at all. Just pure hands-off process.

IIS web application subdomain

I have a little problem. I know that its possible to configure sub domains on my local Machine using host file settings and creating new WEBSITE within iis 7.
Let's say I have an IIS web site. And within it I have another web application defined as application folder not just as a virtual folder (which runs it under same process).
Basically I can access my apps like
Example
http://mydomain.com/app1
http://mydomain.com/app2
i want it to be
http://app1.mydomain.com
http://app2.mydomain.com
Looks like there is an answer at Server Fault.
Basically, create two web sites and set the host header on each to app*.mydomain.com.
But you could also use the IIS7 URL Rewriting Module, and there is an example of use, again at Server Fault
Create new websites with that hostheader and set the directory to that on the local file system of
http://mydomain.com/app1
i.e.
C:\inetpub\wwwroot\app1
Please refer to my other question for the answer to this question. Sorry for the repetition

Deploying DotNetNuke and separate ASP.NET Application together - Possible Issues?

I am making this in a proactive attempt to head off any potential problems which could arise from this. The situation is that we are developing an ASP.NET application for a client which will handle the online ordering from their customers. This application is going to be using the same database that their current WinForms application uses (no real issue here).
At the same time we are developing a new front-end website for them using DotNetNuke. The DotNetNuke app will simply be linking to the ASP.NET application for the customers to submit their orders (no need for them to communicate back and forth, etc.)
The plan is to host both applications on the same box at the client location. What I am looking for are potential problems or setup tips which would prevent possible conflict between the two apps (web.config conflicts, etc.) Is there a problem with having both hosted on the same location, how should IIS be set up, etc.?
If there are any external resources also available which could address this, please feel free to link them as well.
Option 1: Make all the apps separate virtual directories off of the root website. Then have the root document redirect you to the proper subdirectory for the default application for that website(DNN).
Option 2: (DotNetNuke in root, other site in subdirectory) There will be many issues with web.config inheritance if the new application is not built with DotNetNuke, but you can get around these by blocking inheritance of the root web.config. Basically you add the following to your root web.config(DNN) file.
<location path="." inheritInChildApplications="false">
<system.web></system.web>
</location>
Option 3: As Scott said, create seperate sites with differnt subdomains and link them together. You can setup a redirect so whatever.com/order sends a user to order.whatever.com.
Just an FYI, if you use
inheritInChildApplications in DNN 4.7-4.9.2 (haven't verified 5.0) you will run into ScriptManager errors, previous versions of DNN don't have the problem.
We host a DNN site for our corporate site on the same Windows 2003 server with a bunch of other sites (.NET 2.0, SugarCRM, and even some WordPress instances with PHP extensions in IIS). These sites are 'separate' websites, and not subwebs of the default site. It's a real melting pot, and it works well. We did create some separate app pools for the PHP, .NET 2.0, and .NET 3.0/5 sites to ensure that they did not foul each other.

Resources