tags:

views:

177

answers:

1

Hi,

I am putting my files onto a production server. On my development machine I currently use the abp file to generate my code.

For moving the website onto my production server I thought that I would auto generate the files as I was receiving an error with the abp file as I'm not running it under FullTrust.

I ran the following command line to generate the files:

sonic.exe generate /server "serverName" /db "dbName" /generatedNamespace "namespace" /out GeneratedFiles

All of the files generate okay but when I try to run I get the following error:

 Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:

Line 228:       public static Select Select()
Line 229:       {
Line 230:            return Repository.Select();
Line 231:       }
Line 232:       


Source File: ~\AllStructs.cs    Line: 230 (*changed to not show full path)

Any ideas what is causing this? I can't find anything on SubSonics sight which gives me a proper insight into what is happening.

A: 

Do you have an app.config or web.config in your project file with a connection string refering to your instance?

SchlaWiener
Yes, I have a connection string pointing to the DB that i'm using. I'm using a different server on the production machine but have changed the web.config to reflect that. Can the connection string have any bearing on the error?
Fermin
SubSonic defines a provider statically in the generated files. And the provider has an associated connectionstring. I think you need to have both in your web.config file.Try to find the line >>public static DataProvider _provider = DataService.Providers["YourProviderNameHere"]; << in your AllStructs. If SubSonic can't find your provider, it wont run.
SchlaWiener
Note: if you have a provider in your web.config, try to pass the /provider argument to sonic.exe to match the name
SchlaWiener
it was the /provider argument. thanks.
Fermin