Creating Folder in Document workspace thru code

1. When i use the createFolder method of Document Workspace to createfolder in sharepoint(the code which does this is in a WebApplication), The folder is getting created in the specified SharedDocuments, but the Web application itself is throwing an error. Theexact error is as follows :

The virtual server that is referenced here is not in the configdatabase.Description: An unhandled exception occurred during the execution ofthe current web request. Please review the stack trace for moreinformation about the error and where it originated in the code.

Exception Details: System.Runtime.InteropServices.COMException: Thevirtual server that is referenced here is not in the config database.

2. The same code when run from a windows application runssuccessfully.

Go4Sharepoint, is a Microsoft Featured Community.
Microsoft, Windows, Sharepoint, Sharepoint logo, Windows logo, etc are trademarks of the Microsoft Corporation.
All product names, logos, copyrights, and trademarks mentioned are acknowledged as the registered intellectual property of their respective owners. This site is not in any way affiliated with, nor has it been authorized, sponsored, or otherwise approved by, Microsoft Corporation.