当我使用WCF和StructureMap时遇到了这个奇怪的错误。WCF和StructureMap:操作可能会破坏运行时的稳定性
我也试图寻找堆栈,有一些答案是建议安装修补程序:Operation could destabilize the runtime in StructureMap
但我不能因为修补程序安装到"Software Update KB2748645 Installation Wizard does not apply, or is blocked by another condition on your computer. Please click the link below for more details."
public class StructureMapInstanceProvider : IInstanceProvider
{
private readonly Type _serviceType;
public StructureMapInstanceProvider(Type serviceType)
{
_serviceType = serviceType;
}
public object GetInstance(InstanceContext instanceContext, Message message)
{
return ObjectFactory.GetInstance(_serviceType); // error thrown here
}
}
An exception of type 'StructureMap.StructureMapConfigurationException' occurred in StructureMap.dll but was not handled in user code.
Operation could destabilize the runtime.
Additional information:
Attempting to create a build plan for concrete type ProfileService
1.) Attempting to create a BuildPlan for Instance of ProfileService -- ProfileService
2.) Container.GetInstance(ProfileService)
Stacktrace
at StructureMap.Building.ConcreteType.SourceFor(String ctorOrSetter, String name, Type dependencyType, Object value) in c:\BuildAgent\work\996e173a8ceccdca\src\StructureMap\Building\ConcreteType.cs:line 200
at StructureMap.Building.ConcreteType.<>c__DisplayClass4.<BuildConstructorStep>b__3(ParameterInfo x) in c:\BuildAgent\work\996e173a8ceccdca\src\StructureMap\Building\ConcreteType.cs:line 112
at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
at StructureMap.StringExtensions.Each[T](IEnumerable`1 enumerable, Action`1 action) in c:\BuildAgent\work\996e173a8ceccdca\src\StructureMap\Extensions.cs:line 10
at StructureMap.Building.ConstructorStep.Add(IEnumerable`1 dependencies) in c:\BuildAgent\work\996e173a8ceccdca\src\StructureMap\Building\ConstructorStep.cs:line 79
at StructureMap.Building.ConcreteType.BuildConstructorStep(Type pluggedType, ConstructorInfo constructor, DependencyCollection dependencies, Policies policies) in c:\BuildAgent\work\996e173a8ceccdca\src\StructureMap\Building\ConcreteType.cs:line 115
at StructureMap.Building.ConcreteType.BuildSource(Type pluggedType, ConstructorInfo constructor, DependencyCollection dependencies, Policies policies) in c:\BuildAgent\work\996e173a8ceccdca\src\StructureMap\Building\ConcreteType.cs:line 27
我真的不明白错误,而且我也找不到它的来源。 所以我打开建议。