Category Archives: IIS

Testing a .NET .asmx Web Service from LINQPad

Great post here about using the Visual Studio Command Prompt tools to pull the WSDL from a .NET .asmx (traditional, non-WCF) web service and compile a standalone class library which encapsulates the interface.  Basically, run a Visual Studio prompt, switch to a writable directory and run these two commands:

Convert WSDL to service reference .cs classes:

wsdl http://z.com/MyService.asmx

That will create classes in the global namespace and name class file based on the service URL.

Alternately, you can add a namespace and control the name of the output file:

wsdl http://z.com/MyService.asmx /n:MyServiceNamespace /o:MyService.cs

Compile into a class library:

csc /t:library MyService.cs

Then in LINQPad add a reference to the new .dll and the System.Web.Services .NET library.

Then you can write this in LinqPAD:

// create an instance of the service 
var service = new MyService();

// Or namespace version
var service2 = new MyServiceNamespace.MyService();
// invoke a web method and dump the results
service.MyOperation().Dump();

 

How to Connect Process ID to Application Pool in IIS

Under IIS6, you used to be able to run this .vbs script at the command line to list all the running app pools and view their Proc Ids:

c:\windows\system32\iisapp.vbs

That script isn’t shipped with IIS7, and it wouldn’t run anyway without modification and the “IIS6 Management Compatibility” installed.  Instead, you can use appcmd.exe to obtain similar information using this command line:

C:\Windows\System32\inetsrv\appcmd list wp

Note, you will need to run the command line as administrator and be in one of the directories where appcmd.exe esists.  I used the 32-bit example here, but on my 64-bit Windows 7 and Server 2008 machines, appcmd.exe exists in both of these directories and produces the same results:

C:\Windows\System32\inetsrv

C:\Windows\SysWOW64\inetsrv