views:

93

answers:

1

I'm deploying a new .Net 2.0 Asp.Net app with StructureMap 2.0 to a new environment for the first time.

StructureMap Exception Code: 100 Expected file "StructureMap.config" cannot be opened at {pathremoved}..\StructureMap.config

This is confusing because I explicitly told it not to use a config file in my app, I'm doing it all through code.

Inside my Application_Start event I call a static method that executes this:

        StructureMapConfiguration.UseDefaultStructureMapConfigFile = false;
        StructureMapConfiguration.AddRegistry(new UIClassRegistry());

Locally it works fine, on the server it throws an exception.

In my web service I do the same thing, but no errors. Has anyone seen this behavior?

Is the configuration call not being made? Is it being made after my objects have already started making requests to ObjectFactory?

What are some solutions short of creating a config file? If I need a new config file, does it require that I add [Plugin] attributes to my code?

+1  A: 

The global.asax file wasn't copied over by the deployment scripts, without this the Application_Start event doesnt fire and thus, StructureMap isnt configured by the time the ObjectFactory.GetInstance method is called for the first time, so it throws an exception trying to find a config file.

Mr. Graves