. Net Ошибка вызова конечной точки WCF - erorr при загрузке OperationContractAttribute - PullRequest
0 голосов
/ 30 апреля 2020

Как и в заголовке, я создал приложение .netcore (v3.1) и пытаюсь отладить ошибку при вызове wcf с использованием net .tcp port.

Я добавил ссылки на System.ServiceModel

Ошибка в ChannelFactory:

factory = new ChannelFactory<T>(binding, ea);

Ошибка: ошибка при загрузке атрибута «OperationContractAttribute» в методе «GetList» в типе «IService». См. InnerException для получения более подробной информации.

Внутреннее исключение: «Не удалось загрузить тип» System.ServiceModel.Web.WebGetAttribute «из сборки» System.ServiceModel.Web, Версия = 4.0.0.0, Культура = нейтральная, PublicKeyToken = 31bf3856ad364e35 '. ":" System.ServiceModel.Web.WebGetAttribute "

Редактировать Отслеживание стека:

"   at System.ServiceModel.Description.ServiceReflector.GetCustomAttributes(ICustomAttributeProvider attrProvider, Type attrType, Boolean inherit)\r\n   at System.ServiceModel.Description.ServiceReflector.GetCustomAttributes(ICustomAttributeProvider attrProvider, Type attrType)\r\n   at System.ServiceModel.Description.ServiceReflector.GetSingleAttribute[T](ICustomAttributeProvider attrProvider)\r\n   at System.ServiceModel.Description.TypeLoader.CreateOperationDescription(ContractDescription contractDescription, MethodInfo methodInfo, MessageDirection direction, ContractReflectionInfo reflectionInfo, ContractDescription declaringContract)\r\n   at System.ServiceModel.Description.TypeLoader.CreateOperationDescriptions(ContractDescription contractDescription, ContractReflectionInfo reflectionInfo, Type contractToGetMethodsFrom, ContractDescription declaringContract, MessageDirection direction)\r\n   at System.ServiceModel.Description.TypeLoader.CreateContractDescription(ServiceContractAttribute contractAttr, Type contractType, Type serviceType, ContractReflectionInfo& reflectionInfo, Object serviceImplementation)\r\n   at System.ServiceModel.Description.TypeLoader.LoadContractDescriptionHelper(Type contractType, Type serviceType, Object serviceImplementation)\r\n   at System.ServiceModel.Description.TypeLoader.LoadContractDescription(Type contractType)\r\n   at System.ServiceModel.ChannelFactory`1.CreateDescription()\r\n   at System.ServiceModel.ChannelFactory.InitializeEndpoint(Binding binding, EndpointAddress address)\r\n   at System.ServiceModel.ChannelFactory`1..ctor(Binding binding, EndpointAddress remoteAddress)\r\n   at ...."

1 Ответ

0 голосов
/ 30 апреля 2020

Эта ошибка конкретно говорит о сборке. Добавьте ссылку на System.ServiceModel.Web, это должно решить проблему.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...