none
error The caller was not authenticated by the service. When i call my service RRS feed

  • Question

  • 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.


    Tuesday, February 12, 2013 6:32 PM

Answers

  • Hi,

    try to change

    <security mode="Message"> <message clientCredentialType="Windows" /> </security>

    to

    <security mode="None">
    </security>


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, February 12, 2013 9:40 PM
  • Hi,

    After modify the service as suggested above, please rebuild the service and update the service reference or delete the service reference and re-add it. Or try use the default settings for wsDualHttpBinding.

    If the issue exists, what is the inner exceptions? Please enable tracing for your service help to dignose the issue.

    Best Regards.


    Haixia
    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.

    Friday, February 15, 2013 9:56 AM
    Moderator

All replies

  • Hi,

    try to change

    <security mode="Message"> <message clientCredentialType="Windows" /> </security>

    to

    <security mode="None">
    </security>


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, February 12, 2013 9:40 PM
  • First thank you for your response but when i run my app with security mode="None" it has error : Security negotiation failed because the remote party did not send back a reply in a timely manner. This may be because the underlying transport connection was aborted. any ideas?
    Wednesday, February 13, 2013 3:59 AM
  • Hi,

    After modify the service as suggested above, please rebuild the service and update the service reference or delete the service reference and re-add it. Or try use the default settings for wsDualHttpBinding.

    If the issue exists, what is the inner exceptions? Please enable tracing for your service help to dignose the issue.

    Best Regards.


    Haixia
    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.

    Friday, February 15, 2013 9:56 AM
    Moderator
  • thank you very much
    it's working now
    my problem was i did should remove my service and add it again
    Friday, March 8, 2013 5:16 AM