none
WCF System.ServiceModel.Dispatcher.NetDispatcherFaultException RRS feed

  • Question

  • Hi ,

    I have written a simple function GetRuleDetail  in WCF returning below class

    [DataContract]

      public class MyRule

      {

        [DataMember]

        public string st1;

        [DataMember]

        public string st2;

      }

    Now I am using basic http binding my web.config(wcf) is as below

    <system.serviceModel>

        <services>

          <service name="MyService.MyCmdService">

            <endpoint address="" binding="wsHttpBinding" bindingConfiguration="secureHttpBinding" contract="MyService.IMyCmdService">

              <identity>

                <dns value="localhost" />

              </identity>

            </endpoint>

            <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />

            <host>

              <baseAddresses>

                <add baseAddress="http://localhost/MyService/MyCmdService/" />

              </baseAddresses>

            </host>

          </service>

        </services>

        <bindings>

          <wsHttpBinding>

            <binding name="secureHttpBinding">

              <security mode="Message">

                <message clientCredentialType="Windows"/>

              </security>

            </binding>

          </wsHttpBinding>

        </bindings>

        <behaviors>

          <serviceBehaviors>

            <behavior>

              <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->

              <serviceMetadata httpGetEnabled="true"/>

              <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->

              <serviceDebug includeExceptionDetailInFaults="false"/>

            </behavior>

          </serviceBehaviors>

        </behaviors>

        <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />

      </system.serviceModel>

    My client app.config is as below

    <system.serviceModel>

            <bindings>

                <wsHttpBinding>

                     <binding name="WSHttpBinding_IMyCmdService Service" closeTimeout="00:01:00"

                        openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"

                        bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"

                        maxBufferPoolSize="524288" maxReceivedMessageSize="65536"

                        messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"

                        allowCookies="false">

                        <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"

                            maxBytesPerRead="4096" maxNameTableCharCount="16384" />

                        <reliableSession ordered="true" inactivityTimeout="00:10:00"

                            enabled="false" />

                        <security mode="Message">

                            <transport clientCredentialType="Windows" proxyCredentialType="None"

                                realm="" />

                            <message clientCredentialType="Windows" negotiateServiceCredential="true"

                                algorithmSuite="Default" />

                        </security>

                    </binding>

                </wsHttpBinding>

            </bindings>

            <client>

                <endpoint address="http://localhost/Mycmd/ExchangeCmdletService.svc"

                 binding="wsHttpBinding" bindingConfiguration=" WSHttpBinding_IMyCmdService "

                    contract="MyService.IMyCmdService " name=" WSHttpBinding_IMyCmdService ">

                    <identity>

                        <dns value="localhost" />

                    </identity>

                </endpoint>

            </client>

        </system.serviceModel>

    Now when I run this I get below error:

       at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.DeserializeParameterPart(XmlDictionaryReader reader, PartInfo part, Boolean isRequest)

       at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.DeserializeParameter(XmlDictionaryReader reader, PartInfo part, Boolean isRequest)

       at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.DeserializeBody(XmlDictionaryReader reader, MessageVersion version, String action, MessageDescription messageDescription, Object[] parameters, Boolean isRequest)

       at System.ServiceModel.Dispatcher.OperationFormatter.DeserializeBodyContents(Message message, Object[] parameters, Boolean isRequest)

       at System.ServiceModel.Dispatcher.OperationFormatter.DeserializeReply(Message message, Object[] parameters)

       at System.ServiceModel.Dispatcher.ProxyOperationRuntime.AfterReply(ProxyRpc& rpc)

       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)

       at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(System.Runtime.Remoting.Messaging.IMessage, System.Runtime.Remoting.Messaging.IMessage)

       at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(System.Runtime.Remoting.Proxies.MessageData ByRef, Int32)

       at ClientExportRule.CybExchangeService.IExchangeCmdletService.GetRuleDetails(System.String)

       at ClientExportRule.CybExchangeService.ExchangeCmdletServiceClient.GetRuleDetails(System.String)

       at ClientExportRule.Program.Main(System.String[])

    If I move setup(both client and wcf hosting) to another machine (same os 2008 r2 64 bit) it works fine.

    Below is client sied code 

    ExchangeCmdletServiceClientclient = newExchangeCmdletServiceClient("WSHttpBinding_IExchangeCmdletService");

    MyRule rule =  client.GetRuleDetails();

    Any idea what’s wrong?

    Regards,

    Abhagwat

    • Moved by Caillen Wednesday, July 31, 2013 1:36 AM
    Tuesday, July 30, 2013 2:57 PM

Answers

  • Hi,

    I see that you use the following code in client configure file:

    <system.serviceModel>
          <bindings>
    
                <wsHttpBinding>
    
                     <binding name="WSHttpBinding_IMyCmdService Service" 
    ............
    
          </bingings>

    But in your client endpoint, you use the following:

    <endpoint address="http://localhost/Mycmd/ExchangeCmdletService.svc"
    
                 binding="wsHttpBinding" bindingConfiguration=" WSHttpBinding_IMyCmdService "
    


    Please try to change the bindingConfiguration=" WSHttpBinding_IMyCmdService " to bindingConfiguration=" WSHttpBinding_IMyCmdService   Service"

    Best Regards.


    Amy Peng
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.


    Wednesday, July 31, 2013 10:40 AM
    Moderator
  • Hi Amy,

    Sorry about the typo in config file it was correct at my end typo in post.

    The problem is resolved I changed maxStringContentLength="8192" to correct one and it got solved.

    Regards,

    abhawat

    Friday, August 2, 2013 9:12 AM

All replies

  • Hi,

    I see that you use the following code in client configure file:

    <system.serviceModel>
          <bindings>
    
                <wsHttpBinding>
    
                     <binding name="WSHttpBinding_IMyCmdService Service" 
    ............
    
          </bingings>

    But in your client endpoint, you use the following:

    <endpoint address="http://localhost/Mycmd/ExchangeCmdletService.svc"
    
                 binding="wsHttpBinding" bindingConfiguration=" WSHttpBinding_IMyCmdService "
    


    Please try to change the bindingConfiguration=" WSHttpBinding_IMyCmdService " to bindingConfiguration=" WSHttpBinding_IMyCmdService   Service"

    Best Regards.


    Amy Peng
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.


    Wednesday, July 31, 2013 10:40 AM
    Moderator
  • Hi Amy,

    Sorry about the typo in config file it was correct at my end typo in post.

    The problem is resolved I changed maxStringContentLength="8192" to correct one and it got solved.

    Regards,

    abhawat

    Friday, August 2, 2013 9:12 AM