locked
The caller was not authenticated by the service. RRS feed

  • Question

  • my wcf service gave me this error i have no security in my service
    The caller was not authenticated by the service.



    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
      <appSettings>
        <add key="RespinatorDbConnectionString" value="Data Source=RSPN-RESPINATOR;Initial Catalog=RespinatorDb;Persist Security Info=True;User ID=sa;Password=f123" />
        <add key="ClientSettingsProvider.ServiceUri" value="" />
      </appSettings>
      <system.web>
        <compilation debug="true" />
        <membership defaultProvider="ClientAuthenticationMembershipProvider">
          <providers>
            <add name="ClientAuthenticationMembershipProvider" type="System.Web.ClientServices.Providers.ClientFormsAuthenticationMembershipProvider, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" />
          </providers>
        </membership>
        <roleManager defaultProvider="ClientRoleProvider" enabled="true">
          <providers>
            <add name="ClientRoleProvider" type="System.Web.ClientServices.Providers.ClientRoleProvider, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" cacheTimeout="86400" />
          </providers>
        </roleManager>
      </system.web>
      <!-- When deploying the service library project, the content of the config file must be added to the host's
      app.config file. System.Configuration does not support config files for libraries. -->
      <system.serviceModel>
        <serviceHostingEnvironment aspNetCompatibilityEnabled="false" />
        <bindings>
          <wsHttpBinding>
            <binding name="MyNewBinding" maxBufferPoolSize="999999" maxReceivedMessageSize="999999">
            
            </binding>
          </wsHttpBinding>
        </bindings>
        <services>
          <service behaviorConfiguration="RspWS.RspCustSrvBehavior" name="RspWS.RspCustSrv">
            <endpoint address="" binding="wsHttpBinding" bindingConfiguration="MyNewBinding"
              name="MyEndPoint1" contract="RspWS.IRspCustSrv">
              <identity>
                <dns value="localhost" />
              </identity>
            </endpoint>
            <endpoint address="mex" binding="mexHttpBinding" name="MyEndPoint2"
              contract="IMetadataExchange" />
            <host>
              <baseAddresses>
                <add baseAddress="http://localhost:8731/Design_Time_Addresses/RspWS/RspCustSrv/" />
              </baseAddresses>
            </host>
          </service>
        </services>
        <behaviors>
          <serviceBehaviors>
            <behavior name="RspWS.RspCustSrvBehavior">
              <serviceMetadata httpGetEnabled="true" />
              <serviceDebug includeExceptionDetailInFaults="false" />
            </behavior>
          </serviceBehaviors>
        </behaviors>
      </system.serviceModel>
    </configuration>

    Thanks Motevallizadeh
    Wednesday, July 29, 2009 5:55 AM

Answers

  • Hi Motevallizadeh,
       I have  the Same question:
    http://social.microsoft.com/Forums/zh-CN/wcf/thread/3a5417c6-fdd1-47d7-9757-ebc8ede7affb.
        I have created a solution which was used for WCF UserName and Password Security Demo.WSHTTPBinding.
    I have maked a Certificate and set it in the host config file.ClientCertificate is none.
    Host can run successfully.
    When I set the username and password ,then try to open the channel ,There is an error:
      The caller was not authenticated by the service...
      I have search this error on google.but seems nothing to help.
      I am sure the there is something wrong with the Certificate.

      Your WCF service Using <membership defaultProvider="ClientAuthenticationMembershipProvider"> to do the client authentication.
       That must be the reason.client can not give the right UserName or PassWord.
      I am not sure if you need to create a certificate for your service.If you use message or transport security,you need create one .


    Frank.Xu Lei--谦卑若愚,好学若饥
    专注于.NET平台下分布式应用系统开发和企业应用系统集成
    Focus on Distributed Applications Development and EAI based on .NET
    老徐的博客:http://frank_xl.cnblogs.com
    • Marked as answer by motevallizadeh Wednesday, July 29, 2009 12:47 PM
    Wednesday, July 29, 2009 10:18 AM

All replies

  • Hi,

       Generally this exception is thrown, when the credentials of the client are not impersonated by WCF service Host. From the above config file, I understood that you are using WCF web template. Make sure that the user of client appliation is the same domain user of the host. This is because if you are using "wsHttpBinding", then by default it requires windows credentials by default.

    Regards

    Mahesh Sabnis  

    Wednesday, July 29, 2009 6:57 AM
  • Hi Motevallizadeh,
       I have  the Same question:
    http://social.microsoft.com/Forums/zh-CN/wcf/thread/3a5417c6-fdd1-47d7-9757-ebc8ede7affb.
        I have created a solution which was used for WCF UserName and Password Security Demo.WSHTTPBinding.
    I have maked a Certificate and set it in the host config file.ClientCertificate is none.
    Host can run successfully.
    When I set the username and password ,then try to open the channel ,There is an error:
      The caller was not authenticated by the service...
      I have search this error on google.but seems nothing to help.
      I am sure the there is something wrong with the Certificate.

      Your WCF service Using <membership defaultProvider="ClientAuthenticationMembershipProvider"> to do the client authentication.
       That must be the reason.client can not give the right UserName or PassWord.
      I am not sure if you need to create a certificate for your service.If you use message or transport security,you need create one .


    Frank.Xu Lei--谦卑若愚,好学若饥
    专注于.NET平台下分布式应用系统开发和企业应用系统集成
    Focus on Distributed Applications Development and EAI based on .NET
    老徐的博客:http://frank_xl.cnblogs.com
    • Marked as answer by motevallizadeh Wednesday, July 29, 2009 12:47 PM
    Wednesday, July 29, 2009 10:18 AM