Running ASP.NET Web Pages (Razor) Sites Side by Side
This article explains how to run ASP.NET Web Pages (Razor) websites on the same computer or server when the websites are configured to use different versions of ASP.NET Web Pages.
What you'll learn:
- What the default behavior is in ASP.NET when you have sites built with ASP.NET Web Pages 1.0 and ASP.NET Web Pages 2.
- How to configure a new site to run with ASP.NET Web Pages 1.0.
This is the ASP.NET feature introduced in the article:
-
The
webPages:Versionconfiguration setting.
Note The information in this article applies to ASP.NET Web Pages 1.0 and ASP.NET Web Pages 2.
ASP.NET Web Pages 2 supports the ability to run websites side by side. This lets you continue to run your ASP.NET Web Pages 1.0 applications, build new ASP.NET Web Pages 2 applications, and run all of them on the same computer.
Here are some things to remember when you install the Web Pages 2 with WebMatrix:
By default, existing Web Pages applications will run as version 2 applications on your computer. (The assemblies for version 2 are installed in the global assembly cache (GAC) and are used automatically.)
-
If you want to run a site using ASP.NET Web Pages version 1.0, you can configure the site to do that. If your site doesn't already have a web.config file in the root of the site, create a new one and copy the following XML into it, overwriting the existing content. If the site already contains a web.config file, add an
<appSettings>element like the following one to the<configuration>section.<?xml version="1.0"?> <configuration> <appSettings> <add key="webPages:Version" value="1.0"/> </appSettings> </configuration>
`
If you do not specify a version in the web.config file, a site is deployed as a version 2 site. (The version 2 assemblies are copied to the bin folder in the deployed site.)
-
New applications that you create using the site templates in Web Matrix version 2 Beta include the Web Pages version 2 assemblies in the site's bin folder.
In general, you can always control which version of Web Pages to use with your site by using NuGet to install the appropriate assemblies into the site's bin folder. To find packages, visit NuGet.org.
Additional Resources

Comments (0) RSS Feed