none
WCF Issue - Method could not be invoked RRS feed

  • Question

  • Hi all,

    getting lost in a WCF issue, hopefully someone can help me out. 

    I have created a web application which also exposes some WCF services. When running the test application using the local WCF service all is working fine. I have deployed the WCF service to my live hosting provider and when I now try to call a method on the WCF service I receive below error:

    The Method with name 'Authenticate' in Type 'IAuthenticationService' could not be invoked because the application does not have permission to invoke the method: both the Method and its containing Type must be public.

    I really have no clue what is causing this. It seems to be a security issue ?

    Below is a part of my code:

    WEBSITE/SERVICE
    INTERFACE
    [ServiceContract(Namespace = "")]
    interface IAuthenticationService
    {
        [OperationContract]
        bool Authenticate(string Username, string Password);
    }
    
    SERVICE CLASS
    public class AuthenticationService : IAuthenticationService
    {
        public bool Authenticate(string Username, string Password)
        {
            if (Membership.ValidateUser(Username, Password))
                return true;
    
            return false;
        }
    }
    
    
    WEB.CONFIG
    
    <bindings>
       <basicHttpBinding>
          <binding name="basicHttpBinding0"/>
       </basicHttpBinding>
    </bindings>
    <service behaviorConfiguration="AuthenticationServiceBehavior"
            name="AuthenticationService">
            <endpoint address="" binding="basicHttpBinding" bindingConfiguration="basicHttpBinding0"
              contract="IAuthenticationService" />
            <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
          </service>
    CLIENT
    APP.CONFIG
    <system.serviceModel>
        <bindings>
          <basicHttpBinding>
            <binding name="BasicHttpBinding_IAuthenticationService" closeTimeout="00:01:00"
              openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
              allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
              maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
              messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
              useDefaultWebProxy="true">
              <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                maxBytesPerRead="4096" maxNameTableCharCount="16384" />
              <security mode="None">
                <transport clientCredentialType="None" proxyCredentialType="None"
                  realm="" />
                <message clientCredentialType="UserName" algorithmSuite="Default" />
              </security>
            </binding>
          </basicHttpBinding>
        </bindings>
        <client>
          <endpoint address="http://www.mydomain.com/Webservices/AuthenticationService.svc"
            binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IAuthenticationService"
            contract="IAuthenticationService" name="BasicHttpBinding_IAuthenticationService" />
        </client>
      </system.serviceModel>
      <system.net>
        <defaultProxy useDefaultCredentials="true">
    
        </defaultProxy>
      </system.net>
    
    
    PROGRAM
    AuthenticationServiceClient client = new AuthenticationServiceClient();
    client.Authenticate("USER", "PASS");

    I hope someone can help me out. Tried to lookup this error but didn;t find anything.

    Thanks in advance.

    Brgds,
    Maurice
    Tuesday, October 20, 2009 11:54 AM

Answers

  • Try to make public your interface IAuthenticationService
    Fabio Cozzolino Blogs: http://dotnetside.org/blogs/fabio http://weblogs.asp.net/fabio
    Tuesday, October 20, 2009 2:08 PM