DanBayley

I've been using the database factory now for ages in web applications and recently upgraded a VB.Net software app to use it as well.

All is working fine in the development environment but when I depoy using a deployment project I keep getting an exception when I call DatabaseFactory.CreateDatabase()

{"Object reference not set to an instance of an object."}

Under the delaring method :

'((System.Type)(((System.Reflection.MemberInfo)(((System.Exception)($exception)).TargetSite)).DeclaringType)).DeclaringMethod' threw an exception of type 'System.InvalidOperationException'

"Method may only be called on a Type for which Type.IsGenericParameter is true."

Any ideas



Re: ASMX Web Services and XML Serialization DatabaseFactory.CreateDatabase() exception

DanBayley

I've dug a little deeper and found that this might be a trust issue of some sort (at least I think).

The method that fails is

get_DefaultName()

if I explicitly specify the database name it says it can't find it even though it clearly exists an the exact same app.config file works in the development environment (VS 2005) on the same computer.





Re: ASMX Web Services and XML Serialization DatabaseFactory.CreateDatabase() exception

DanBayley

Had another play and I can now make it work outside the development environment by putting the connection string in the machine.config instead of the app.config (not practical, but proves my config code works and that the app isn't faulty).

So the issue seems to be that the application can get the connection details from the machine config but not the app config.

Can anyone give me a quick solution to this I can't be the first to experience it!





Re: ASMX Web Services and XML Serialization DatabaseFactory.CreateDatabase() exception

Matt Neerincx

I would check with the ASP.NET forum folks for this one, they would know more about this. Moving your thread.




Re: ASMX Web Services and XML Serialization DatabaseFactory.CreateDatabase() exception

DanBayley

hmmm not sure how I managed to end up in that forum! but its windows foms not asp.net.

anyway I think I've resolved it now.... It was a simple problem after all that.

The deployment package was deploying the wrong app.config file so it looked like the correct one was there with all the correct details but it wasn't!