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!
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
...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
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...
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?
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
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
Copy link to clipboard
Copied
A solution that will certainly help someone else in future - thanks for sharing it!
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
Copy link to clipboard
Copied
As for the Arguments problem, see also http://stackoverflow.com/questions/8438342/cfexecute-not-executing-appcmd-exe
Copy link to clipboard
Copied
This whole post was extremely helpful RLS, thanks!!
Copy link to clipboard
Copied
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