2013-03-06 3 views
1

У меня есть Вейрдест проблемы с Spring.NET, при попытке преобразовать свой проект с .NET 3.5 для .NET 4.Spring.Net Заполнитель исключение

Позвольте мне подвести итог нашей архитектуры: Project A (не под моим управления) имеет Sprint.Net конфигурации, ссылающийся на установку (configurationProvider.url), как это:

<constructor-arg name="Url" value="${configurationProvider.url}" /> 

Project B (мой проект, под моим контролем) имеет другой конфигурационный файл со значением этого параметра:

<configuration> 
    <Environment> 
    <add key="Dashboard.Environment"  value="UAT" /> 
    <add key="configurationProvider.url" value="http://something/ConfigurationProvider.asmx"/> 
    <add key="pkicheck.url"    value="http://something/webservices/pkicheck.asmx"/> 
    <add key="sso.url"     value="http://something/webservices/ssoclient.asmx"/> 
    </Environment> 
</configuration> 

Все работает очень хорошо, когда Project B был .NET 3.5. При преобразовании этого проекта в .NET 4 (и это единственное изменение), все это начинает сбиваться, и это дает мне это исключение:

Could not resolve placeholder 'configurationProvider.url' 

Это, очевидно, не найти настройки конфигурации на файл конфигурации ProjectB , хотя этот файл есть и содержит значение. Что могло измениться между 3,5 и 4?

Полное исключение:

<ConfigurationErrorsException d1p1:type="ConfigurationErrorsException"> 
<ClassName>System.Configuration.ConfigurationErrorsException</ClassName> 
<Message>Error creating context 'spring.root': Error registering object with name 'configurationProvider' defined in 'assembly [ProjectA.Core, Version=0.0.0.88, Culture=neutral, PublicKeyToken=1b28b51fb20f454e], resource [ProjectA.Core.Framework.config] line 111' : Could not resolve placeholder 'configurationProvider.url'.</Message> 
<Data d1p1:type="IDictionary"/> 
<InnerException d1p1:type="Exception"> 
<ClassName>Spring.Objects.Factory.ObjectDefinitionStoreException</ClassName> 
<Message>Error registering object with name 'configurationProvider' defined in 'assembly [ProjectA.Core, Version=0.0.0.88, Culture=neutral, PublicKeyToken=1b28b51fb20f454e], resource [ProjectA.Core.Framework.config] line 111' : Could not resolve placeholder 'configurationProvider.url'.</Message> 
<Data d1p1:type="IDictionary"/> 
<InnerException d1p1:type="Exception"/> 
<HelpURL/> 
<StackTraceString> at Spring.Objects.Factory.Config.PropertyPlaceholderConfigurer.ProcessProperties(IConfigurableListableObjectFactory factory, NameValueCollection props) at Spring.Objects.Factory.Config.PropertyResourceConfigurer.PostProcessObjectFactory(IConfigurableListableObjectFactory factory) at Spring.Context.Support.AbstractApplicationContext.ProcessObjectFactoryPostProcessors(IList objectFactoryPostProcessors) at Spring.Context.Support.AbstractApplicationContext.InvokeObjectFactoryPostProcessors() at Spring.Context.Support.AbstractApplicationContext.Refresh() at Spring.Context.Support.XmlApplicationContext..ctor(Boolean refresh, String name, Boolean caseSensitive, IApplicationContext parentContext, String[] configurationLocations) at Spring.Context.Support.XmlApplicationContext..ctor(String name, Boolean caseSensitive, String[] configurationLocations) at _dynamic_Spring.Context.Support.XmlApplicationContext..ctor(Object[]) at Spring.Reflection.Dynamic.SafeConstructor.Invoke(Object[] arguments) at Spring.Context.Support.ContextHandler.RootContextInstantiator.InvokeContextConstructor(ConstructorInfo ctor) at Spring.Context.Support.ContextHandler.ContextInstantiator.InstantiateContext() at Spring.Context.Support.ContextHandler.InstantiateContext(IApplicationContext parentContext, Object configContext, String contextName, Type contextType, Boolean caseSensitive, String[] resources) at Spring.Context.Support.ContextHandler.Create(Object parent, Object configContext, XmlNode section)</StackTraceString> 
<RemoteStackTraceString/> 
<RemoteStackIndex>0</RemoteStackIndex> 
<ExceptionMethod>8 ProcessProperties Spring.Core, Version=1.3.0.20349, Culture=neutral, PublicKeyToken=65e474d141e25e07 Spring.Objects.Factory.Config.PropertyPlaceholderConfigurer Void ProcessProperties(Spring.Objects.Factory.Config.IConfigurableListableObjectFactory, System.Collections.Specialized.NameValueCollection)</ExceptionMethod> 
<HResult>-2146232832</HResult> 
<Source>Spring.Core</Source> 
<WatsonBuckets d1p1:type="System.Byte"d1p1:includeArrayAttribute="true"/> 
<_resourceDescription>assembly [ProjectA.Core, Version=0.0.0.88, Culture=neutral, PublicKeyToken=1b28b51fb20f454e], resource [ProjectA.Core.Framework.config] line 111</_resourceDescription> 
<_objectName>configurationProvider</_objectName> 
</InnerException> 
<HelpURL/> 
<StackTraceString> at System.Configuration.BaseConfigurationRecord.EvaluateOne(String[] keys, SectionInput input, Boolean isTrusted, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult) at System.Configuration.BaseConfigurationRecord.Evaluate(FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult, Boolean getLkg, Boolean getRuntimeObject, Object& result, Object& resultRuntimeObject) at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject) at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject) at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject) at System.Configuration.BaseConfigurationRecord.GetSection(String configKey) at System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection(String sectionName) at System.Configuration.ConfigurationManager.GetSection(String sectionName) at Spring.Util.ConfigurationUtils.GetSection(String sectionName) at Spring.Context.Support.ContextRegistry.InitializeContextIfNeeded() at Spring.Context.Support.ContextRegistry.GetContext() at ProjectA.Core.Controller.Initialise(String flavour) in d:\TeamCity8100\buildAgent\work\850180d7b576030f\Code\Src\ProjectA\Framework\Core\Controller.cs:line 238</StackTraceString> 
<RemoteStackTraceString/> 
<RemoteStackIndex>0</RemoteStackIndex> 
<ExceptionMethod>8 EvaluateOne System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a System.Configuration.BaseConfigurationRecord System.Object EvaluateOne(System.String[], System.Configuration.SectionInput, Boolean, System.Configuration.FactoryRecord, System.Configuration.SectionRecord, System.Object)</ExceptionMethod> 
<HResult>-2146232062</HResult> 
<Source>System.Configuration</Source> 
<WatsonBuckets d1p1:type="System.Byte"d1p1:includeArrayAttribute="true"/> 
<filename d1p1:type="Object"/> 
<line>0</line> 
<firstFilename d1p1:type="Object"/> 
<firstLine>0</firstLine> 
<count>0</count> 
</ConfigurationErrorsException> 
+0

Пожалуйста, разместите соответствующие разделы конфигурации или весь файл App.config/Web.config (где находится часть configSections вашего web.config) и ваша конфигурация объекта PropertyPlaceholderConfigurer. – Andreas

ответ

1

В конце концов я нашел проблему. Мы используем PropertyPlaceholderConfigurer в нашей конфигурации, и мы никогда не устанавливаем свойство «Заказ». Поэтому «Весна» была «упорядочена» по заказу, но поскольку порядок всегда был равен int.Max, вывод заказа был недетерминированным.

Добавление заказа в файл конфигурации исправлено.

+1

Не могли бы вы привести пример того, как вы это исправили? (пожалуйста, покажите код) – RuudKok

Смежные вопросы