none
Dynamic Proxy in WCF while accessing the Invoke Method throwing TargetInvocationException RRS feed

  • Question

  • Using Dynamic Proxy in WCF(based on the blog

    http://blogs.msdn.com/b/vipulmodi/archive/2006/11/16/dynamic-programming-with-wcf.aspx)
     
    while invoking Method, i am getting the following error.
     
    System.Reflection.TargetInvocationException was unhandled
       Message=Exception has been thrown by the target of an invocation.
       Source=mscorlib
       StackTrace:
            at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
            at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
            at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
            at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
            at System.Type.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args)
            at WcfSamples.DynamicProxy.DynamicObject.CallMethod(String method, NetworkCredential credentials, Object[] parameters) in e:\From_Downloaded\SampleCode\WCFDynamicProxy\WCFDynamicProxy\src\DynamicObject.cs:line 146
            at WcfSamples.DynamicProxy.Example.Program.InvokeService(DynamicProxyFactory factory) in e:\From_Downloaded\SampleCode\WCFDynamicProxy\WCFDynamicProxy\Example\DynamicClient\Program.cs:line 121
            at WcfSamples.DynamicProxy.Example.Program.Main(String[] args) in e:\From_Downloaded\SampleCode\WCFDynamicProxy\WCFDynamicProxy\Example\DynamicClient\Program.cs:line 97
            at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
            at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
            at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
            at System.Threading.ThreadHelper.ThreadStart()
       InnerException: System.ServiceModel.ProtocolException
            Message=A reply message was received for operation 'GetName' with action 'http://schemas.microsoft.com/net/2005/12/windowscommunicationfoundation/dispatcher/fault'. However, your client code requires action 'http://Services/Contracts/IServerService/GetNameResponse'.
            Source=mscorlib
            StackTrace:
              Server stack trace:
                at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
                 at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
                 at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
                 at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
              Exception rethrown at [0]:
                at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
                 at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
                 at IServerService.GetName(GetNameRequest request)
                 at ServerServiceClient.IServerService.GetName(GetNameRequest request)
                 at ServerServiceClient.GetName(Int64 empID)
            InnerException:


    It is working fine if the Service is don't have the authentcation. If the Service is installed as NTLM authencation then it is throwsing this error. Help me to resolve this. It is blocking my deliverables.

     

    • Edited by Britto Raj Sunday, October 26, 2014 3:52 PM
    Sunday, October 26, 2014 3:49 PM

Answers

All replies

  • I checked endpoint.Binding isSystem.ServiceModel.BasicHttpBinding

    Then Proceed. It solve the issue.

    Monday, October 27, 2014 4:36 AM
  • Hi,

    It's very glad to see you have figured the issue out and it's very grateful you could share the solution with us. And it would
    be helpful to other communities, and welcome to post your question in this forum in your future programming.

    Regards


    Monday, October 27, 2014 5:57 AM
    Moderator