WCF services with a number of different methods (endpoints)

Asked

Viewed 73 times

0

I took a project that uses WCF and I’m not getting to solve this mystery.

I have two Solutions: Project A and Project B. When he tries to instantiate the OAuthServiceClient within the Project B, it generates the following error:

Could not find default endpoint element that References Contract 'Ssowebservice.Ioauthservice' in the Servicemodel client Configuration Section. This Might be because no Configuration file was found for your application, or because no endpoint element matching this Contract could be found in the client element.

Code of Ambient.ServiceModelClients.config

<client>
  <endpoint address="http://sso.fundacao.interno/SSO/WebServices/OAuthService.svc"
            binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IOAuthService"
            contract="OAuthService.IOAuthService" name="BasicHttpBinding_IOAuthService" />
</client>

This happens, I believe, by difference in amount of WCF methods from Project B (30 endpoints) and Project A (15 endpoints).

P.S. When reviewing the code again I realize that there are within the Reference.Cs 5 constructs file that are not defined within the interface

public interface IOAuthService {

    [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IOAuthService/IsValidToken", ReplyAction="http://tempuri.org/IOAuthService/IsValidTokenResponse")]
    LoginResult IsValidToken(string token, string appClientID);

    // mais 29 outros métodos
        ....
    }

and there in the implementation there are 5 builders, that I can define from where they are inherited

public partial class OAuthServiceClient : System.ServiceModel.ClientBase<IOAuthService>, IOAuthService {

public OAuthServiceClient() {

}

public OAuthServiceClient(string endpointConfigurationName) : 
        base(endpointConfigurationName) {
}

//... outros construtores

public LoginResult IsValidToken(string token, string appClientID) {
        return base.Channel.IsValidToken(token, appClientID);
}

//outros 29 métodos
....
  • wouldn’t be because of the Ssowebservice setup in appsetings or appconfig ??

  • I don’t think so, but that depends on what configuration we’re talking about. Anyway I notice that within the WCF References (environment.ServicemodelClients.config,Configuration.svcinfo,Reference.Cs) they point to : <endpoint name="BasicHttpBinding_IOAuthService" ***contract="OAuthService.IOAuthService"*** bindingType="basicHttpBinding" address="http://siteDaEmpresa/SSO/WebServices/OAuthService.svc" bindingConfiguration="BasicHttpBinding_IOAuthService">

  • And you’re not calling this WS in some other different layer, where this endpoint does not exist in config and the client is not initializing?

  • someone could format the code please tried several ways but it didn’t work

  • @Leandroangelo, I believe I have already done the conference of all references , and they all point to the same URL http://sso.fundacao.internal/SSO/WebServices/OAuthService.svc

  • My question was: If you use Servicemodelclients on Projectoa and or in the Projectob, the configuration needs to be done in their config as well

Show 1 more comment

1 answer

0

Referência do Serviço

Hello I ended up solving the problem by simply deleting and adding again the references of the service.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.