Knowledge Base

PRB: VB Component Not Marked Apartment Produces ASP 0115 Error

PSS ID Number: 191979

Article Last Modified on 12/1/2003


The information in this article applies to:


This article was previously published under Q191979

SYMPTOMS

When instantiating an ActiveX dynamic-link library (DLL) created with Visual Basic 5.0 within an Active Server Page using the Server.CreateObject, the following error may occur:
Error 'ASP 0115'
Unexpected error

/<VirtualRoot>/<ASPPage>

A trappable error occurred in an external object. The script cannot continue running.

RESOLUTION

Apply Visual Studio 97 Service Pack 3 or later to Visual Basic 5.0 and recompile the ActiveX DLL.

NOTE: Applying the latest version of the service pack will also apply fixes from the previous versions of the service pack.

Use the following steps to recompile the ActiveX DLL in Visual Basic with the latest service pack:
  1. Open the ActiveX DLL project.
  2. From the menu, select Project and go into <ProjectName> Properties where <ProjectName> is the name of the ActiveX DLL project.
  3. In the <ProjectName> - Project Properties dialog box, click the General tab.
  4. Go to the Threading Model frame and choose Apartment Threaded in the combo box. Click OK.
  5. Recompile ActiveX DLL component and apply it back to the Web server.
  6. Register the ActiveX DLL component on the Web server using RegSvr32.exe, if necessary.
NOTE: Apartment-model threading is the recommended threading model for components that will be called by Active Server Pages.

REFERENCES

For more information on threading support in Internet Information Server 4.0, refer to the following paper "
Improving the Performance of Data Access Components with IIS 4.0".

There is more information on apartment-model threading, in the MSDN Library: Specifically, look at Apartment-Model Threading in Visual Basic.

Additional query words: viasp vb ActiveX dll asp kbdsi

Keywords: kbprb kbScript KB191979
Technology: kbASPsearch kbAudDeveloper kbVB500 kbVB500Search kbVBSearch kbZNotKeyword2 kbZNotKeyword6