Skip to content

System.IO.FileNotFoundException: Could not load file or assembly 'System.ServiceModel.Primitives, Version=4.5.0.3 #337

Open
@rudidlo

Description

@rudidlo

When trying to deliver message using unary call getting following exception on net4.8
using GrpcWebHandler to connect with service on Http1

GrpcWebHandler grpcWebHandler = new GrpcWebHandler(GrpcWebMode.GrpcWebText, (HttpMessageHandler) new HttpClientHandler());
     return GrpcChannel.ForAddress(this.serviceUri, new GrpcChannelOptions()
     {
       HttpHandler = (HttpMessageHandler) grpcWebHandler
     });

I get following missing reference error

System.TypeInitializationException: The type initializer for 'DefaultProxyCache1' threw an exception. ---> System.IO.FileNotFoundException: Could not load file or assembly 'System.ServiceModel.Primitives, Version=4.5.0.3, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. 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(RuntimeType type, RuntimeType caType, Boolean inherit) at System.Attribute.GetCustomAttributes(MemberInfo element, Type type, Boolean inherit) at System.Attribute.GetCustomAttribute(MemberInfo element, Type attributeType, Boolean inherit) at ProtoBuf.Grpc.Internal.ProxyEmitter.CreateFactory[TService](BinderConfiguration binderConfig) in /_/src/protobuf-net.Grpc/Internal/ProxyEmitter.cs:line 120 at ProtoBuf.Grpc.Configuration.ClientFactory.DefaultProxyCache1..cctor() in //src/protobuf-net.Grpc/Configuration/ClientFactory.cs:line 81
--- End of inner exception stack trace ---
at ProtoBuf.Grpc.Configuration.ClientFactory.DefaultClientFactory.CreateClient[TService](CallInvoker channel) in /
/src/protobuf-net.Grpc/Configuration/ClientFactory.cs:line 91

I have fixed it by adding System.ServiceModel.Primitives as my nuget package dependency.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions