Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to set the framework version with IISVDIR ?

0 views
Skip to first unread message

Elmue

unread,
May 15, 2008, 12:03:31 PM5/15/08
to
Hello

I wrote a script which uses IISVDIR to add the .NET projects to the IIS.

The problem is that some ASPX solutions are written for framework 1.1
and others for framework 2.0.

I could not find a way how to programmatically set the framework
version.

Currently my script is quite useless as all framework 2.0 projects will
not run. I have to MANUALLY change the framework in the IIS Adminisrtator.

I want to run that 100% automatically.

Can anybody help me, please ?
Thanks.

Elmü

Elmue

unread,
May 15, 2008, 2:03:27 PM5/15/08
to
Hello

I already found that the command

c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis.exe
-s w3svc/553851221/root/Path/MyAspxSolution

does what I need: convert an already existing 1.1 project into a 2.0
Project.

But where do I get the metabase number 553851221 from ?

All samples in the internet use a 1 (one) instead.
(w3svc/1/root)
But this does not work on my server.


Why does Microsoft make all so unneccesary complicated ??
I hate them!

Elmü


Elmue

unread,
May 15, 2008, 2:45:35 PM5/15/08
to
Yeah !
I've got it !

The strange metabase number 553851221 seems to be a Hash which is
calculated from the name of the website.

It is only "1" if you run your webservice in the "Predefined Websites"

If I change the name the magic number also changes.
If I use the old name again the number is the same again.

So it is safe to use this number in your scripts as long as the name of
the website does not change in your script:

IIsWeb /create D:\Path\RootFolder "NameOfWebSite" /b 80

To get a list of all WebSites you can use this .NET code:


using System.DirectoryServices;

DirectoryEntry i_Parent = new DirectoryEntry("IIS://localhost/w3svc");

foreach (DirectoryEntry i_Entry in i_Parent.Children)
{
string s_Path = i_Entry.Path;

if (i_Entry.SchemaClassName == "IIsWebServer")
{
string s_Comment = i_Entry.Properties["ServerComment"]
.Value.ToString();

foreach (DirectoryEntry i_Dir in i_Entry.Children)
{
if (i_Dir.SchemaClassName == "IIsWebVirtualDir")
{
...
}
}
}
else if ((i_Entry.SchemaClassName == "IIsWebVirtualDir") ||
(i_Entry.SchemaClassName == "IIsWebDirectory"))
{
...
}
}


Elmü

Juan T. Llibre

unread,
May 15, 2008, 2:44:53 PM5/15/08
to
re:
!> But where do I get the metabase number 553851221 from ?

Run :

aspnet_regiis -lk

That will list the correct data you want, in the format :

W3SVC/somenumber/ROOT/AppName/ .NetVersionNumber


Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
======================================
"Elmue" <ab...@gmx.de> wrote in message news:euZi6Xrt...@TK2MSFTNGP05.phx.gbl...

Elmue

unread,
May 15, 2008, 4:45:46 PM5/15/08
to
Hello

Now that my script has moved the website to run on framework 2.0
it still does not work.

Error: "The service is not available!"

I still have to manually set the AppPool to a pool that runs framework 2.0.

How can I change the Default App Pool for only one website via a script?

I havn't got a glimpse.

Elmú

Elmue

unread,
May 15, 2008, 6:22:09 PM5/15/08
to
After one entire day of investigation I also solved the last problem:

Put this into a file "SetAppPool.vbs"


option explicit

Const GENERAL_FAILURE = 2
Const POOLED_PROCESS = 2
Const CREATE_POOL_IF_NOT_EXIST = true

If WScript.Arguments.Count < 2 Then
WScript.Echo
WScript.Echo
"-------------------------------------------------------------------------"
WScript.Echo "This script assigns a Web Application to a pool"
WScript.Echo "Usage: SetAppPool MetaPath PoolName"
WScript.Echo "If the name contains spaces the name must be enclosed
in quotation marks."
WScript.Echo "Example:"
WScript.Echo "SetAppPool W3SVC/553851221/Root/AppName Net2Pool"
WScript.Echo
"-------------------------------------------------------------------------"
WScript.Echo
WScript.Quit (GENERAL_FAILURE)
End If

Dim sWebApp
sWebApp = "IIS://localhost/" & WScript.Arguments.Item(0)

Dim IIsWebVDirObj
Set IIsWebVDirObj = GetObject(sWebApp)

IIsWebVDirObj.AppCreate3 POOLED_PROCESS, WScript.Arguments.Item(1),
CREATE_POOL_IF_NOT_EXIST
IIsWebVDirObj.SetInfo

0 new messages