Click here to Skip to main content
15,908,445 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
i want to communicate with the wcf service from wpf client, but i cant configure it after trying and searching online for 5 hours ... i tried about 30 ways i found online, but none of them worked really, so if someone here know these stuffs, you are welcome to help, i saw everyone is posting their configurations, so here i will post, and if you can spot some problem...

WPF CLIENT App.config
XML
<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <configSections>
        <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
            <section name="LDT_ACP_WPF.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
        </sectionGroup>
    </configSections>
  
  
    <startup> 
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1"/>
    </startup>
  
  
  
    <system.serviceModel>
        <bindings>
            <netTcpBinding>
                <binding name="NetTcpBinding_IACP1" />
            </netTcpBinding>
        </bindings>
      
        <client>
            <endpoint address="net.tcp://jesse-pc/ACP.svc" binding="netTcpBinding"
                bindingConfiguration="NetTcpBinding_IACP1" contract="ACP_Service.IACP"
                name="NetTcpBinding_IACP1">
                <identity>
                    <servicePrincipalName value="host/Jesse-PC" />
                </identity>
            </endpoint>
        </client>
    </system.serviceModel>

</configuration>


WCF Web.config
XML
<?xml version="1.0"?>
<configuration>

  <appSettings>
    <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
  </appSettings>
  
  <system.web>
    <compilation debug="true" defaultLanguage="c#" targetFramework="4.5" />
    <pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID" />
    <authentication mode="None">
      <forms cookieless="AutoDetect" loginUrl="ACP.svc" />
    </authentication>
    <identity impersonate="false" />
    <authorization>
      <allow users="*" />
    </authorization>
    <roleManager enabled="true" />
    <customErrors mode="Off"/>
  </system.web>
  
  
  
  
  
  <system.serviceModel>
    <bindings>
      <netTcpBinding>
        <binding name="netTcpBinding_IReceiverController" closeTimeout="00:00:05" openTimeout="00:00:05" receiveTimeout="00:10:00" sendTimeout="00:00:05" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288" maxReceivedMessageSize="65536">
          <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
          <reliableSession ordered="true" inactivityTimeout="00:10:00" />
          <security mode="None">
            <message clientCredentialType="None" />
          </security>
        </binding>
      </netTcpBinding>
    </bindings>

    <behaviors>
      <serviceBehaviors>
        <behavior name="">
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="true" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    
    <!--<protocolMapping>
        <add binding="basicHttpsBinding" scheme="https" />
    </protocolMapping>-->

    <services>
      <service name="LDT_ACP_Service.ACP">
        <host>
          <baseAddresses>
            <add baseAddress="net.tcp://localhost:24534/" />
            <add baseAddress="http://localhost/ACP.svc"/>
          </baseAddresses>
        </host>
        <endpoint address="mex"
            binding="mexHttpBinding"
            contract="IMetadataExchange" />
        <endpoint address="" binding="netTcpBinding" contract="LDT_ACP_Service.IACP" />


      </service>
    </services>
    </system.serviceModel>
  
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
    <directoryBrowse enabled="true" showFlags="Date, Time, Size, Extension, LongDate"/>
  </system.webServer>

</configuration>


the error i get when i call any function from the service is:
An exception of type 'System.ArgumentOutOfRangeException' occurred in mscorlib.dll but was not handled in user code

Additional information: The supported values are Identification, Impersonation or Delegation.


thanks in advance.
Posted
Comments
Sergey Alexandrovich Kryukov 16-Jan-16 15:02pm    
You can catch this exception and output the exception stack, to find out where in your code the exception is thrown. This exception type is one of the easiest to locate and fix.
—SA
Hrishikesh Ranjit Shivacharan 18-Jan-16 3:04am    
are you deploy this service?
Sergey Alexandrovich Kryukov 18-Jan-16 3:13am    
What do you mean by that?
—SA
SrgjanX 18-Jan-16 3:36am    
alright i fixed it, i will post the solution later today, if anybody needs it...
also ive got new problem which i have no clue how to fix, i will try to find solution online, else will post that here on codeproject too.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900