Мое приложение имеет 10 Wcfservice (приложение WcfService на платформе .NET Framework 3.5) с тем же программным обеспечением и аппаратным обеспечением, но только 1 принимает это исключение: < /em> < /strong> < /p>
, когда пользователь входит в систему. public IService Select(SelectServiceRequest request)
{
IAxxxService anagServ = IoC.Container.Resolve(request.GetRegisteredService().ToString());
return xxxServ;
}
< /code>
с реализацией getRegeSearedService () с ClientIdentifier = 0 для первого выполнения < /p>
public RegisteredServices GetRegisteredService()
{
RegisteredServices res = RegisteredServices.Estxxx;
if (ClientIdentifier == 0)
{
res = RegisteredServices.Anaxxx;
}
else if (ClientIdentifier == 1)
{
res = RegisteredServices.Prixxx;
}
else if (ClientIdentifier == 2)
{
res = RegisteredServices.Estrxxx;
}
else if (ClientIdentifier == 3)
{
res = RegisteredServices.LixxAnagrxx;
}
return res;
}
< /code>
с реализацией и инициацией кода IOC: < /p>
internal class IoC{
private static IUnityContainer container = new UnityContainer();
private static bool isInitialized = false;
public static IUnityContainer Container
{
get
{
if (!isInitialized)
{
lock (container)
{
if (!isInitialized)
container.RegisterType(RegisteredServices.Esxxxxx.ToString());
container.RegisterType(RegisteredServices.Anaxxxx.ToString());
container.RegisterType(RegisteredServices.Prixxxx.ToString());
container.RegisterType(RegisteredServices.LixxxAnagxx.ToString());
isInitialized = true;
}
}
}
return container;
}
}
< /code>
} < /p> < /li>
< /ul> < /li>
< /ul>
Я имею это исключение в методе выполнения "Resiple": < /p>
system.reflection.targetin. цель вызова.
---> microsoft.practices.unity.resolutionfailedException: разрешение не удалось, type =
"apcon.iservice", name = "anagxxx". Сообщение об исключении:
Текущая операция сборки (ключ ключа сборки сборки [apcon.standardservice, anaxxxx]) Не удалась:
Текущая операция сборки (ключ для сборки сборки [apcon.standardservice, anaxxxx])).
(тип стратегии DynamicMetodConstructorStrategy, Index 0) (стратегический тип BuildPlanstrategy, Index 3)
---> Microsoft.Practices.ObjectBuilder2.buildFailedExcept Ключ [apcon.standardservice, anagrafe]) неудачный: индекс находился за пределами
границ массива.
(тип стратегии DynamicmethodConstructorStrategy, Index 0) (стратегический тип BuildPlanstrategy, Index 3)
---> Microsoft.Practices.ObjectBuilder2.BuildFailedException: текущая операция сборки
(ключ для сборки сборки [apcon.standardservice, anagxx). (Тип стратегии DynamicmethodConstructorStrategy, Index 0)
---> System.indexoutofrangeException: индекс был за пределами массива. at
system.collections.generic.list1.add (t item) at
microsoft.practices.objectbuilder2.dependencyresolvertrackerpolicy.addresolverkey (Object
key) на
Microsoft.Practices.ObjectBuilder2.constructorSelectorpolicybase`1.createSelectedConstructor (ibuilderContext
контекст, конструкция ctor) at
microsoft.practices.objectbuilder2.constructroplectropolectorpoLicypoLicybase1.selectRectrustructructructructructructructructructructructructructructructructructructorcrecturectorce. /> Microsoft.practices.objectBuilder2.dynamicMethodConstructorStrategy.prebuildup (ibuilderContext
context) at
microsoft.practices.objectbuilder2.strategychain.executebuildup (ibuilderconceptext
context). /> < /blockquote>
Может ли это быть инструкции по блокировке? Кажется, что типы не были зарегистрированы и инициализированы, стали истинными
Подробнее здесь: https://stackoverflow.com/questions/367 ... ncy-failed
Unity + C# - "разрешение зависимости не удалось" ⇐ C#
Место общения программистов C#
-
Anonymous
1751911555
Anonymous
Мое приложение имеет 10 Wcfservice (приложение WcfService на платформе .NET Framework 3.5) с тем же программным обеспечением и аппаратным обеспечением, но только 1 принимает это исключение: < /em> < /strong> < /p>
, когда пользователь входит в систему. public IService Select(SelectServiceRequest request)
{
IAxxxService anagServ = IoC.Container.Resolve(request.GetRegisteredService().ToString());
return xxxServ;
}
< /code>
с реализацией getRegeSearedService () с ClientIdentifier = 0 для первого выполнения < /p>
public RegisteredServices GetRegisteredService()
{
RegisteredServices res = RegisteredServices.Estxxx;
if (ClientIdentifier == 0)
{
res = RegisteredServices.Anaxxx;
}
else if (ClientIdentifier == 1)
{
res = RegisteredServices.Prixxx;
}
else if (ClientIdentifier == 2)
{
res = RegisteredServices.Estrxxx;
}
else if (ClientIdentifier == 3)
{
res = RegisteredServices.LixxAnagrxx;
}
return res;
}
< /code>
с реализацией и инициацией кода IOC: < /p>
internal class IoC{
private static IUnityContainer container = new UnityContainer();
private static bool isInitialized = false;
public static IUnityContainer Container
{
get
{
if (!isInitialized)
{
lock (container)
{
if (!isInitialized)
container.RegisterType(RegisteredServices.Esxxxxx.ToString());
container.RegisterType(RegisteredServices.Anaxxxx.ToString());
container.RegisterType(RegisteredServices.Prixxxx.ToString());
container.RegisterType(RegisteredServices.LixxxAnagxx.ToString());
isInitialized = true;
}
}
}
return container;
}
}
< /code>
} < /p> < /li>
< /ul> < /li>
< /ul>
Я имею это исключение в методе выполнения "Resiple": < /p>
system.reflection.targetin. цель вызова.
---> microsoft.practices.unity.resolutionfailedException: разрешение не удалось, type =
"apcon.iservice", name = "anagxxx". Сообщение об исключении:
Текущая операция сборки (ключ ключа сборки сборки [apcon.standardservice, anaxxxx]) Не удалась:
Текущая операция сборки (ключ для сборки сборки [apcon.standardservice, anaxxxx])).
(тип стратегии DynamicMetodConstructorStrategy, Index 0) (стратегический тип BuildPlanstrategy, Index 3)
---> Microsoft.Practices.ObjectBuilder2.buildFailedExcept Ключ [apcon.standardservice, anagrafe]) неудачный: индекс находился за пределами
границ массива.
(тип стратегии DynamicmethodConstructorStrategy, Index 0) (стратегический тип BuildPlanstrategy, Index 3)
---> Microsoft.Practices.ObjectBuilder2.BuildFailedException: текущая операция сборки
(ключ для сборки сборки [apcon.standardservice, anagxx). (Тип стратегии DynamicmethodConstructorStrategy, Index 0)
---> System.indexoutofrangeException: индекс был за пределами массива. at
system.collections.generic.list1.add (t item) at
microsoft.practices.objectbuilder2.dependencyresolvertrackerpolicy.addresolverkey (Object
key) на
Microsoft.Practices.ObjectBuilder2.constructorSelectorpolicybase`1.createSelectedConstructor (ibuilderContext
контекст, конструкция ctor) at
microsoft.practices.objectbuilder2.constructroplectropolectorpoLicypoLicybase1.selectRectrustructructructructructructructructructructructructructructructructructructorcrecturectorce. /> Microsoft.practices.objectBuilder2.dynamicMethodConstructorStrategy.prebuildup (ibuilderContext
context) at
microsoft.practices.objectbuilder2.strategychain.executebuildup (ibuilderconceptext
context). /> < /blockquote>
Может ли это быть инструкции по блокировке? Кажется, что типы не были зарегистрированы и инициализированы, стали истинными
Подробнее здесь: [url]https://stackoverflow.com/questions/36721447/unity-c-sharp-resolution-of-the-dependency-failed[/url]
Ответить
1 сообщение
• Страница 1 из 1
Перейти
- Кемерово-IT
- ↳ Javascript
- ↳ C#
- ↳ JAVA
- ↳ Elasticsearch aggregation
- ↳ Python
- ↳ Php
- ↳ Android
- ↳ Html
- ↳ Jquery
- ↳ C++
- ↳ IOS
- ↳ CSS
- ↳ Excel
- ↳ Linux
- ↳ Apache
- ↳ MySql
- Детский мир
- Для души
- ↳ Музыкальные инструменты даром
- ↳ Печатная продукция даром
- Внешняя красота и здоровье
- ↳ Одежда и обувь для взрослых даром
- ↳ Товары для здоровья
- ↳ Физкультура и спорт
- Техника - даром!
- ↳ Автомобилистам
- ↳ Компьютерная техника
- ↳ Плиты: газовые и электрические
- ↳ Холодильники
- ↳ Стиральные машины
- ↳ Телевизоры
- ↳ Телефоны, смартфоны, плашеты
- ↳ Швейные машинки
- ↳ Прочая электроника и техника
- ↳ Фототехника
- Ремонт и интерьер
- ↳ Стройматериалы, инструмент
- ↳ Мебель и предметы интерьера даром
- ↳ Cантехника
- Другие темы
- ↳ Разное даром
- ↳ Давай меняться!
- ↳ Отдам\возьму за копеечку
- ↳ Работа и подработка в Кемерове
- ↳ Давай с тобой поговорим...
Мобильная версия