Classic ASP with Enterprise Library -Data Block.

Topics: Data Access Application Block
Mar 12, 2008 at 7:34 AM
Edited Mar 12, 2008 at 11:52 AM
Heres the scenario...

An ASP Page calls a c# component registered using regasm /tlb seehash.dll

I know the registration of the dll has gone fine because for testing purposes the dll just returned a simple string 'IamSeeHash' which got displayed on the asp page. Then I went back to my seehash.dll, uncommented the following line
Database db = DatabaseFactory.CreateDatabase();
and recompiled the dll and re-registered it again.

now I get the error 'Object reference not set to an instance of an object.'

I figure this could be because the config file cant be located by the asp process, so I created a copy of the config files in the SystemRoot%\System32 directory as 'dllhost.exe.config' and also 'asp.dll.config'
another copy named as 'index.asp.config' in the asp pages root directory. still I get the same error


I even went back to my seehash.dll and modified the line to add the specific database name
Database db = DatabaseFactory.CreateDatabase("MyDb");
then it says 'The requested database MyDb is not defined in configuration.'

What is going wrong? Please help.

Thanks.


+Heres my config file +


<configuration>
<configSections>
<section
name="dataConfiguration"
type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings,
Microsoft.Practices.EnterpriseLibrary.Data" />
</configSections>

<connectionStrings>
<add
name="MyDb"
providerName="System.Data.SqlClient"
connectionString=
"server=(local)\SQLEXPRESS;
database=MyDb;
UID=sa;PWD=usa;" />
</connectionStrings>

<dataConfiguration defaultDatabase="MyDb"/>
</configuration>


+Heres my folder structure +

For the asp page
C:\Inetpub\wwwroot\simpleAspSite

For the dlls (all referenced dlls of the datablock are in this directory)
c:\mydlls\seehash.dll