Does ASP.Net MVC4 Cache References?
I ran into an issue today that is making me pull my hair out.
I've created a WCF service which is fairly simple as it only exposes two
operations and no data contracts. This WCF service sits on top of a
business logic layer. Inside this business logic layer is a dll which
exposes some contracts (just plain interfaces).
I've also created two test clients for the service. One is a console
client and the other is a MVC4 application. Both reference the same
endpoints and they both reference, through a project reference, the
contract dll.
Now, all is fine until I change the contract by adding or removing a
method, or even changing the signature of an existing method. At that
point my MVC4 app blows and throws all over the place. Keep in mind that
I'm not changing the WCF contract, just some internal contracts.
The reason is that inside of the business logic layer I am initializing my
AutoMapper profiles via a static constructor. Inside this static
constructor I basically get all the assemblies of the current domain and
iterate through them looking for objects that implement IProfile. It's
when I start trying to get types out of one of the dlls that reference the
contracts dll that I get a fatal exception: System.TypeLoadException.
Now, the console client behaves just fine. Again, referencing the same
dll's through a project reference. I can change that contracts dll all day
long and it's just happy as a lark, but MVC4 blows chunks. If I go back
and make the interface exactly like it was before MVC4 is happy.
I noticed that the path to the assembly that was failing to load is in the
Temporary ASP.Net files location. I blasted that entire directory and
still no luck.
I can supply code, but it might be better if I gave you a dependency
graph. There's already about 5k lines of code in the BLL.
Thanks in advance.
No comments:
Post a Comment