Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# WCF VB.NET
hi
 
i wrote a wcf service with wsDualHttpBinding
 
my web.config in Service is :
 
<?xml version="1.0"?>
<configuration>
  <system.web>
    <compilation debug="true" strict="false" explicit="true" targetFramework="4.0" />
     <customErrors mode="Off"/>
</system.web>
  <system.serviceModel>
    <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>
    <services>
      <service name="Chat_Server.Service_Chat">
        <endpoint binding="wsDualHttpBinding" bindingConfiguration="DuplexBinding" contract="Chat_Server.IService_Chat">
        </endpoint>
      </service>
    </services>
    <bindings>
      <wsDualHttpBinding>
        <binding name="DuplexBinding">
          <reliableSession ordered="false"
            inactivityTimeout="00:02:00" />
          <security mode="Message">
            <message clientCredentialType="Windows" />
          </security>
        </binding>
      </wsDualHttpBinding>
    </bindings>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true" />
  </system.webServer>
</configuration>
and my web.config in Client is :
<system.serviceModel>
        <bindings>
            <wsDualHttpBinding>
                <binding name="WSDualHttpBinding_IService_Chat" />
            </wsDualHttpBinding>
        </bindings>
        <client>
            <endpoint address="http://localhost:1462/Service_Chat.svc" binding="wsDualHttpBinding"
                bindingConfiguration="WSDualHttpBinding_IService_Chat" contract="ServiceReference_Chat.IService_Chat"
                name="WSDualHttpBinding_IService_Chat">
                <identity>
                    <userPrincipalName value="mycomputername" />
                </identity>
            </endpoint>
        </client>
    </system.serviceModel>
and this is my code in client for Open Service :
'===================
        'Open Service
        Dim context As New InstanceContext(New CallBack_Chat())
        Dim m_ServiceContext As Service_ChatClient
 
        Dim binding As New WSDualHttpBinding()
        binding.Name = "WSDualHttpBinding_IService_Chat"
        binding.ReliableSession.Ordered = True
        binding.TextEncoding = Text.Encoding.UTF8
        binding.ReliableSession.InactivityTimeout = New TimeSpan(0, 1, 0)
        binding.ReceiveTimeout = New TimeSpan(0, 1, 0)
        binding.SendTimeout = New TimeSpan(0, 0, 30)
        m_ServiceContext = New Service_ChatClient(context, "WSDualHttpBinding_IService_Chat")
        m_ServiceContext.Endpoint.Binding = binding
 
        m_ServiceContext.Open()
        '===================
but when i run my project it has error (The caller was not authenticated by the service. When i call my service)
 
where is my problem?
 
thank you.
Posted 12-Feb-13 8:42am

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Try adding windows credentials to service client via code like:
m_ServiceContext.ClientCredentials.Windows.ClientCredential.UserName = "serverusername";
m_ServiceContext.ClientCredentials.Windows.ClientCredential.Password = "serverpassword";
m_ServiceContext.ClientCredentials.Windows.ClientCredential.Domain = "serverdomain";
See if that helps.
  Permalink  
Comments
Sina asefi at 12-Feb-13 14:45pm
   
First thank you for your response
but it did not work again
do you have any other ideas?
thank you
Sandeep Mewara at 12-Feb-13 14:47pm
   
Ok. Nothing else for now.

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 535
1 Kornfeld Eliyahu Peter 407
2 Maciej Los 369
3 DamithSL 221
4 OriginalGriff 218
0 OriginalGriff 6,353
1 DamithSL 4,854
2 Maciej Los 4,476
3 Kornfeld Eliyahu Peter 4,058
4 Sergey Alexandrovich Kryukov 3,917


Advertise | Privacy | Mobile
Web01 | 2.8.141223.1 | Last Updated 12 Feb 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100