• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How to consume Microsoft.Web.Administration?

Contributor ,
Dec 19, 2012 Dec 19, 2012

Copy link to clipboard

Copied

I have been managing websites in IIS6, but I understand that things have changed radically in IIS7 and that "all I need to do" is consume the services available in Microsoft.Web.Administration's servermanager and Microsoft.Web.Management and I'll have all the services and methods I need to replicate what I was doing in IIS6.

Well and good if you're savvy on that whole "consume services" thing, which I suck at.

I am told I can find this in c:\windows\system32\inetsrv\Microsoft.Web.Administration.dll and, indeed, it is there.

Try as I might, I cannot figure out how to pull this into an object so I can consume it.  I've tried:


<cfobject type="COM" action="CREATE" class="Microsoft.Web.Administration" name="objMicrosoftWeb">



<cfobject action="create" class='Microsoft.Web' name="objMicrosoftWeb" type="com">

<script>

set myServerManager = CreateObject('.NET', 'ServerManager', 'c:\windows\system32\inetsrv\Microsoft.Web.Administration.dll');

</script>

<cfobject


name="serverManager"

component="c:\windows\system32\inetsrv\Microsoft.Web.Administration.dll" />

all to no avail.  I am obviously not a COM genius.

Can anyone clue me in?  I think even if I could figure out how to get a list of classes and methods I might be able to reign this in, but, alas, I am clueless in this arena.

Thanks!

TOPICS
Advanced techniques

Views

3.4K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Contributor , Dec 19, 2012 Dec 19, 2012

I guess the trick is all in how you phrase your question when searching for the answer.

Out of desperation, I searched for the error message I was receiving, and this (http://forums.adobe.com/message/4227246) provided me the answer, right from here within the CF Forums, something I had already searched.

I was using:

<cfobject type="dotnet" name="Mtable" class="ApplicationDomain"

          assembly="c:/windows/system32/inetsrv/Microsoft.Web.Administration.dll">

and getting an error stating that the c

...

Votes

Translate

Translate
LEGEND ,
Dec 19, 2012 Dec 19, 2012

Copy link to clipboard

Copied

You can get a list of classes by googling Microsoft.Web.Administration and selecting an offering from msdn.microsoft.com    

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Dec 19, 2012 Dec 19, 2012

Copy link to clipboard

Copied

Thank you, but that does not list the service as it appears on my computer / server nor does it help me to figure out how to code the createobject capture that I need.  I've been staring at that damn msdn article / series and a million other articles about Microsoft.Web.Administration but none of them give me the answer and I've tried but I cannot figure it out myself. Thanks, but I need hand holding this time...

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 19, 2012 Dec 19, 2012

Copy link to clipboard

Copied

You could always take another approach.  What did you used to be able to do with IIS 6 that you can't do with IIS 7?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Dec 19, 2012 Dec 19, 2012

Copy link to clipboard

Copied

In IIS6 I was using the metabase with a variety of exe and vbs files.

In IIS7 I want to take advantage of the XML structure. I could probably use AppCMD but that seems so old school. I'd prefer to use the API and, in my mind, do it correctly and likely much more efficiently.

I just don't know how to list the services that are outside of Cold Fusion. ColdFusion Builder doesn't show them to me and I can't find a copy of OLEVIEWER to download, so I'm having trouble peeking under the hood.

I've tried so many variations on trying to make an object out of Microsoft.Web.Administration.dll that my fingers are numb and my eyes are bleeding. I don't know why I can't find any specific instance on the web of someone doing this with ColdFusion; it's weird, frankly.

To me, it's a simple question that SOMEONE out there must have answered by now. Knowing the name of an object on your computer, how do you create a CFObject out of it so you can use the services?  But that's probably just me not knowing some reason why that won't work.

This is what I want to get, first. Once I have that, I think I can figure the rest out: http://msdn.microsoft.com/en-us/library/ms614834(v=vs.90).aspx

RLS

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Dec 19, 2012 Dec 19, 2012

Copy link to clipboard

Copied

I guess the trick is all in how you phrase your question when searching for the answer.

Out of desperation, I searched for the error message I was receiving, and this (http://forums.adobe.com/message/4227246) provided me the answer, right from here within the CF Forums, something I had already searched.

I was using:

<cfobject type="dotnet" name="Mtable" class="ApplicationDomain"

          assembly="c:/windows/system32/inetsrv/Microsoft.Web.Administration.dll">

and getting an error stating that the class was not found in the assembly list (Class ApplicationDomain not found in the specified assembly list. The assembly that contains the class must be provided to the assembly attribute).

By simply giving it the COMPLETE class name, as such:

<cfobject type="dotnet" name="Mtable" class="Microsoft.Web.Administration.ApplicationDomain"

          assembly="c:/windows/system32/inetsrv/Microsoft.Web.Administration.dll">

I attained success.

This question is resolved. Hope this helps someone else looking for this solution.

RLS

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 27, 2012 Dec 27, 2012

Copy link to clipboard

Copied

A solution that will certainly help someone else in future - thanks for sharing it!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jan 29, 2013 Jan 29, 2013

Copy link to clipboard

Copied

Alas, the "correct" answer was not the end of this story, not the solution I needed ("how to add a web site dynamically using ColdFusion").

Microsoft, in their infinite wisdom, has provided pretty clear (?) examples on how to manage web sites dynamically using these tools in C#, VB, Javascript, and so on, but for some reason they just don't work well in ColdFusion. (if you are a crossover programmer and can tell us all how to do this, please chime in! I'd love to use the object services instead of below).

While I was able to consume the object, I could not get their methods to work for me in ColdFusion 8. I am not well trained on using C# and objects and all that (old school programmer; emphasis on the "old" - started programming in 1980 and CF since 1996) and I had to get this working, so I returned to what I knew, and that was command line executables.

Answer=appcmd.exe.

http://www.iis.net/learn/get-started/getting-started-with-iis/getting-started-with-appcmdexe helped immensely.

For example, to simply add a web site, try this (and, yes, I know that the arguments can be an array, but cfexecute does not like "add site" as an argument, yes you can make it all in the string instead of the array, and yes, the double-quotes are significant); make sure you change the names and bindings to suit your situation, such as having internal IP addresses instead of external:

<CFOUTPUT>

          <CFTRY>

                    <CFSCRIPT>

                              TestArguments = ArrayNew(1);

                              TestArguments[1] = '/name:"My Test Site"';

                              TestArguments[2] = '/physicalPath:"d:\websites\testSite\www"';

                              TestArguments[3] = '/bindings:"http/127.0.0.1:80:abbtestsite.com,http/127.0.0.1:80:www.abbtestsite.com"';

                              TestArguments[4] = '/state:Started';

                    </CFSCRIPT>

                    <CFEXECUTE name="C:\Windows\System32\inetsrv\appcmd.exe" variable="resultVariable" timeout="15"

arguments='add site #TestArguments[1]# #TestArguments[2]# #TestArguments[3]# #TestArguments[4]#'  />

                    <cfdump var="#resultVariable#" label="resultVariable" >

                    <CFCATCH TYPE="ANY">

                        <cfdump var="#cfcatch#" label="#cfcatch#">

        </CFCATCH>

          </CFTRY>

</CFOUTPUT>

NOTE: CFEXECUTE does not like using %systemroot% in place of "C:\Windows" (or whereever it is for you).

NOTE: This does not do the DNS entries for you.

Have fun!

RLS

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jan 29, 2013 Jan 29, 2013

Copy link to clipboard

Copied

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 02, 2014 Jan 02, 2014

Copy link to clipboard

Copied

This whole post was extremely helpful RLS, thanks!!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jan 17, 2014 Jan 17, 2014

Copy link to clipboard

Copied

LATEST

Thanks, Mr. McGuigan.

Looking at that code example - I'm betting cfdump will balk at label="#cfcatch#" !!  Better to not use a structure in a label!

Guess it never errored for me or I'd have found that out....

RLS

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation