Пример #1
0
      static ServiceEndpointCollection QueryMexEndpoint(string mexAddress,Binding binding,TokenProvider tokenProvider)
      {
         dynamic extendedBinding = binding;
         extendedBinding.MaxReceivedMessageSize *= MessageSizeMultiplier;

         MetadataExchangeClient mexClient = new MetadataExchangeClient(extendedBinding);
         mexClient.SetServiceBusCredentials(tokenProvider);
         MetadataSet metadata = mexClient.GetMetadata(new EndpointAddress(mexAddress));
         MetadataImporter importer = new WsdlImporter(metadata);
         return importer.ImportAllEndpoints();
      }
Пример #2
0
      static ServiceEndpointCollection QueryMexEndpoint(string mexAddress,Binding binding,string issuer,string secret)
      {
         Binding extendedBinding = null;

         if(binding is NetTcpRelayBinding)
         {
            NetTcpRelayBinding actualBinding = binding as NetTcpRelayBinding;
            actualBinding.MaxReceivedMessageSize *= MessageSizeMultiplier;
            extendedBinding = actualBinding;
         }
         if(binding is WS2007HttpRelayBinding)
         {
            WS2007HttpRelayBinding actualBinding = binding as WS2007HttpRelayBinding;
            actualBinding.MaxReceivedMessageSize *= MessageSizeMultiplier;
            extendedBinding = actualBinding;
         }

         MetadataExchangeClient mexClient = new MetadataExchangeClient(extendedBinding);
         mexClient.SetServiceBusCredentials(issuer,secret);
         MetadataSet metadata = mexClient.GetMetadata(new EndpointAddress(mexAddress));
         MetadataImporter importer = new WsdlImporter(metadata);
         return importer.ImportAllEndpoints();
      }