问题
I'm trying to set up the automated (nightly) installation of my web site setup project. I can specify some install-time values on the command line; in particular, adding a TARGETSITE
value defines the web site to which my new deployment will go.
How do I find the metabase key to my web site (eg. "/LM/W3SVC/213548468") in an IIS7 installation? (I do have IIS6 compatibility all set up, but I can't find anything about my site in the metabase.xml file.)
Also, since the web deployment setup projects are obviously outdated mechanisms (I guess they were too easy to use?), does anyone have a better idea for my nightly automated deployments?
回答1:
In IIS 7 and above we do not use the metabase anymore and instead moved to a ".config" model where we store all the settings inside "%windir%\system32\inetsrv\config\applicationHost.config", that is where you will find all the information and settings you apply. If you enable IIS 6 compatibility we will run all the commands by translating them directly into the new ApplicationHost.config.
It would be useful to know more about how you are doing it today, If you use Managed code probably the best solution is using Microsoft.Web.Administration (http://blogs.msdn.com/b/carlosag/archive/2006/04/17/microsoftwebadministration.aspx) which includes a class called ServerManager to allow you to set everything you need.
If you use scripts (vbscript/jscript) you can continue using your scripts or instead use AHADMIN which is our new underlying COM configuration api.
if you use powershell we also have a PowerShell provider (http://www.iis.net/download/PowerShell) provide which should be the best in that case.
Also, if you actually want to package contents and configuration and other stuff like Registry settings, COM objects, GAC dlls, etc, you should use Web Deploy (http://www.iis.net/download/WebDeploy)
回答2:
I know nothing about metabase, but from your posts I was able to cobble together the following:
import-module WebAdministration
$site = get-website | Where-object {$_.Name -eq "SiteName"}
$id=$site.ID
setup.msi /passive TARGETAPPPOOL=`"ASP.NET v4.0`" TARGETSITE="/LM/W3SVC/"$id
The backtick marks are the escape characters for powershell.
来源:https://stackoverflow.com/questions/3285651/where-is-the-metabase-key-for-my-iis7-web-site