问题
On my develop machine all ok, but when I try app on test machine with WinXp sp3 I encountered a problem.
The method call contains the code below takes 1,5 minute
var c = new UnityContainer();
Unity version 2.0.414.0 .Net Framework v 3.5 sp1
Does any one know how to fix it?
Thanks
回答1:
Does your test machine have internet access? If not, it could be hanging trying to verify the authenticode certificate on the binary. A quick test would be to build Unity from source and use that dll instead. If it doesn't hang then that was the problem. There's a way turn off the cert check in the app.config file; I'll update this answer once I get a chance to look it up.
回答2:
I don't know if it will make a different or not, but you can try this instead.
UnityContainer c = new UnityContainer();
OR
IUnityContainer myContainer = new UnityContainer();
Also, have you done the following:
- Provide an XML format configuration file that adheres to the schema shown in Source Schema for the Unity Application Block.
- Use the methods of the container to add specific registration entries for default and named mappings.
- Use the container configuration API to provide a custom configuration for the container.
Maybe this can help:
http://msdn.microsoft.com/en-us/library/ff648211.aspx
来源:https://stackoverflow.com/questions/4399764/unity-container-creation-slowdown-on-some-machines