Jonathan Yong is back with this quick ‘tip of the day’. Relevant if you are migrating an older COM+ application to Windows 2008 or above.
If you have a COM+ component which is called by classic ASP page and after you migrate the application to IIS 7.x or above, you may encounter runtime error ‘This object is meant to be called by ASP pages only’ every time the ASP page call some methods in the COM component.
A hypothetical code repro is as follow:
Set myCom = Server.CreateObject("ComApp.Bar") ’Call to this method cause runtime error myCom.Foo(param)
Set myCom = Server.CreateObject("ComApp.Bar")
’Call to this method cause runtime error myCom.Foo(param)
This happen if the method internally access ASP Request or Response object, or what we technically call the Intrinsic objects. It turn out that in Windows Server 2008 and above, if COM+ component need to access intrinsic object, there is an additional configuration you need to turn on in COM+ component.
Open Component Services, right click on the COM component -> Advanced tab -> check the ‘Allow IIS intrinsic properties’. Then restart the COM+ application and recycle the IIS app pool running the ASP application. Here is a quick illustration: