we don't want to go with proxy generation approach for consuming WCF services.
We have tried to call the WCF using System.servicemodel.Primitives and deriving from clientBase class.
however when we try to create instance of child class of Clientbase it is giving the following error
System.PlatformNotSupportedException: 'Configuration files are not supported.'

Hi @pardhumeduri sorry for running into this. WCF on .NET Core does not support configuration, so as the error suggested, please choose other constructors of ClientBase that does not take configuration.
Hi Zhenlan
i am able to fix this issue after changing the constructor to use binding, EndPoint, however getting the following issue, kindly let us know if there any way we can consume WCF services in Core 2.0 wihthout generating proxy classes.
Also please share if we have any samples solutions on how to consume wcf in core 2.0 without WCF connectivity tool ( proxy)

i am able to fix this issue after changing the constructor to use binding, EndPoint, however getting the following issue, kindly let us know if there any way we can consume WCF services in Core 2.0 wihthout generating proxy classes.
Also please share if we have any samples solutions on how to consume wcf in core 2.0 without WCF connectivity tool ( proxy)

Hi, @pardhumeduri I am glad you are able to make progress.
kindly let us know if there any way we can consume WCF services in Core 2.0 wihthout generating proxy classes.
Certainly, you don't have to use the tool to generate the proxy code (using ClientBase etc.). Here is an example that uses BasicHttpBinding and calls a simple Echo service on the server. Is it helpful to you? Please feel free to explore other tests for more complex scenarios.
https://github.com/dotnet/wcf/blob/master/src/System.Private.ServiceModel/tests/Scenarios/Binding/Http/BasicHttpBindingTests.4.0.0.cs
hi Zhenlan
I have done the following steps
1) Created WCF service in .Net 4.5.2
2) Hosted it in IIS
3) using ChannelFactory option tried to consume the service in Core 2.0
it worked , i am able to hit the .net4.5.2 wcf service from Core 2.0 console application However if we add reference to some of the .net4.5.2 dlls ( models dll which was part .net 4.5.2) and tried to use those models in generating request and response then we are facing "system.servicemodel.dll" not found issue. Please suggest how we can proceed further.
{System.InvalidOperationException: An error occurred while loading attribute 'OperationContractAttribute' on method 'test' in type 'TestService'. Please see InnerException for more details. ---> System.IO.FileNotFoundException: Could not load file or assembly 'System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. The system cannot find the file specified.
at System.ModuleHandle.ResolveType(RuntimeModule module, Int32 typeToken, IntPtr* typeInstArgs, Int32 typeInstCount, IntPtr* methodInstArgs, Int32 methodInstCount, ObjectHandleOnStack type)
at System.ModuleHandle.ResolveTypeHandleInternal(RuntimeModule module, Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext)
at System.Reflection.RuntimeModule.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
at System.Reflection.CustomAttribute.FilterCustomAttributeRecord(CustomAttributeRecord caRecord, MetadataImport scope, Assembly& lastAptcaOkAssembly, RuntimeModule decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, Object[] attributes, IList derivedAttributes, RuntimeType& attributeType, IRuntimeMethodInfo& ctor, Boolean& ctorHasParameters, Boolean& isVarArg)
at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes, Boolean isDecoratedTargetSecurityTransparent)
at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeMethodInfo method, RuntimeType caType, Boolean inherit)
at System.ServiceModel.Description.CustomAttributeProvider.GetCustomAttributes(Type attributeType, Boolean inherit)
at System.ServiceModel.Description.ServiceReflector.GetCustomAttributes(CustomAttributeProvider attrProvider, Type attrType, Boolean inherit)
--- End of inner exception stack trace ---
at System.ServiceModel.Description.ServiceReflector.GetCustomAttributes(CustomAttributeProvider attrProvider, Type attrType, Boolean inherit)
at System.ServiceModel.Description.ServiceReflector.GetCustomAttributes(CustomAttributeProvider attrProvider, Type attrType)
at System.ServiceModel.Description.ServiceReflector.GetSingleAttributeT
at System.ServiceModel.Description.ServiceReflector.GetOperationContractAttribute(MethodInfo method)
at System.ServiceModel.Description.TypeLoader.CreateOperationDescription(ContractDescription contractDescription, MethodInfo methodInfo, MessageDirection direction, ContractReflectionInfo reflectionInfo, ContractDescription declaringContract)
at System.ServiceModel.Description.TypeLoader.CreateOperationDescriptions(ContractDescription contractDescription, ContractReflectionInfo reflectionInfo, Type contractToGetMethodsFrom, ContractDescription declaringContract, MessageDirection direction)
at System.ServiceModel.Description.TypeLoader.CreateContractDescription(ServiceContractAttribute contractAttr, Type contractType, Type serviceType, ContractReflectionInfo& reflectionInfo, Object serviceImplementation)
at System.ServiceModel.Description.TypeLoader.LoadContractDescriptionHelper(Type contractType, Type serviceType, Object serviceImplementation)
at System.ServiceModel.Description.TypeLoader.LoadContractDescription(Type contractType)
at System.ServiceModel.ChannelFactory1.CreateDescription()
at System.ServiceModel.ChannelFactory.InitializeEndpoint(Binding binding, EndpointAddress address)
at System.ServiceModel.ChannelFactory1..ctor(Binding binding, EndpointAddress remoteAddress)
at CoreWCFClient.Program.CheckAuthenticateService(String strServer, String strBinding, Int32 nPort, String strOper, String userID, Double dblVal2) in c:\users\u1jca83\documents\visual studio 2017\Projects\CoreWCFClient\CoreWCFClient\Program.cs:line 151}
Good to see further progress. In your .NET Core 2.0 app, you should not reference assemblies from the full framework (eg. 4.5.2). May I know why you need to do this?
we have some applications in .Net 4.5.2 which we is source for .Net Core 2.0 application. We get the MVC Models from .Net 4.5.2 which is common models for Core and .Net applications. we do not want re create model solution in core because if any changes done in source will not be in sync. hence we wanted to refer .Net 4.5.2 dlls in core 2.0
we have tested the .net4.5.2 dll reference in Core 2.0 web and console application we are able to use the models in them, however when we try to do the same with WCF services then we are facing system.servicemodel.dll" not found issue.
@pardhumeduri this is because a shim that forwards WCF APIs from full framework to .NET Core was missing. We are rebuilding System.ServiceModel.Primitives package to include this shim (#2375) and hopefully, we can have the package released soon after testing etc. (in weeks). In the meanwhile, it will be great if you can give the package built out of master branch a try to see if it fixes your issue.
@pardhumeduri we just released to nuget.org an update of System.ServiceModel.Primitives package, which contains the System.ServiceModel.dll shim you would need. Can you please update your project to reference this package and see if it solves your problem?
https://www.nuget.org/packages/System.ServiceModel.Primitives/4.4.1-servicing-25917-01
Sure .. will try and update you back.
On Nov 20, 2017 8:31 PM, "Zhenlan Wang" notifications@github.com wrote:
@pardhumeduri https://github.com/pardhumeduri we just released to
nuget.org an update of System.ServiceModel.Primitives package, which
contains the System.ServiceModel.dll shim you would need. Can you please
update your project to reference this package and see if it solves your
problem?https://www.nuget.org/packages/System.ServiceModel.
Primitives/4.4.1-servicing-25917-01—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/dotnet/wcf/issues/2293#issuecomment-345887283, or mute
the thread
https://github.com/notifications/unsubscribe-auth/ADLAxFdo5idQTACtGHYzmo2YHrEbvgQsks5s4ifogaJpZM4Pbk_n
.
@zhenlan I am getting a critical error and the shim doesn't work. The UWP version doesn't work either.
A stable version of System.ServiceModel.Primitives package that has the fix of this issue has been released early last week.
https://www.nuget.org/packages/System.ServiceModel.Primitives/4.4.1
A stable version of
System.ServiceModel.Primitivespackage that has the fix of this issue has been released early last week.
https://www.nuget.org/packages/System.ServiceModel.Primitives/4.4.1
The problem still is not solved
@zhenlan This issue is still an issue even when referencing System.ServiceModels.Primitives >= 4.5.3. Any guidance on solving that issue.
I solved this by explicitly specifying the binding and the endpointAddress. My understanding is; if given all parameters, there is no need to look for a configuration file - which is the culprit.
This, of course, rests on the availabily of a constructor, which allows your to explicitly configuring the consumerclient.